Py-faster-rcnn: support 1080P and cudnn v5?

Created on 1 Jul 2016  ·  72Comments  ·  Source: rbgirshick/py-faster-rcnn

so far, faster-rcnn surpports 1080P and cudnn v5?

thanks.

Most helpful comment

Maybe you can try to merge caffe master branch into caffe-fast-rcnn.

cd caffe-fast-rcnn  
git remote add caffe https://github.com/BVLC/caffe.git  
git fetch caffe  
git merge -X theirs caffe/master  

Remove self_.attr("phase") = static_cast<int>(this->phase_); from include/caffe/layers/python_layer.hpp after merging.


py-R-FCN use Microsoft-version Caffe which is compatible with cudnn 5.

All 72 comments

@rbgirshick can you do me a favor? thanks.

+1 echo Zimenglan.

Hi @rbgirshick ,

Thank you so much for your hard work on py-faster-cnn. I would like to humbly request if you can please modify faster-rcnn to work with cudnn v5. The new GPUs like 1080 can't use anything less than v5. This would greatly be appreciated.

Thank you,
Evan

Maybe you can try to merge caffe master branch into caffe-fast-rcnn.

cd caffe-fast-rcnn  
git remote add caffe https://github.com/BVLC/caffe.git  
git fetch caffe  
git merge -X theirs caffe/master  

Remove self_.attr("phase") = static_cast<int>(this->phase_); from include/caffe/layers/python_layer.hpp after merging.


py-R-FCN use Microsoft-version Caffe which is compatible with cudnn 5.

@manipopopo thanks. it's a real help, it works! now i can use 1080P and v5 of cudnn.
@EvanWeiner you can try. self_.attr("phase") = static_cast<int>(this->phase_) from include/caffe/layers/python_layer.hpp is the key.

Hi @manipopopo
I followed your instruction, but encountered an error when I run /tools/demo.py
The error message is as follwoing:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0713 03:15:46.031435 22906 _caffe.cpp:122] DEPRECATION WARNING - deprecated use of Python interface
W0713 03:15:46.031481 22906 _caffe.cpp:123] Use this instead (with the named "weights" parameter):
W0713 03:15:46.031488 22906 _caffe.cpp:125] Net('/root/py-faster-rcnn/models/pascal_voc/VGG16/faster_rcnn_alt_opt/faster_rcnn_test.pt', 1, weights='/root/py-faster-rcnn/data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel')
[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 350:21: Message type "caffe.LayerParameter" has no field named "roi_pooling_param".
F0713 03:15:46.033658 22906 upgrade_proto.cpp:79] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /root/py-faster-rcnn/models/pascal_voc/VGG16/faster_rcnn_alt_opt/faster_rcnn_test.pt
* Check failure stack trace: *
Aborted (core dumped)

How do I solve this problem?

Make sure that optional ROIPoolingParameter roi_pooling_param = 8266711; is in caffe-fast-rcnn/src/caffe/proto/caffe.proto. Remember to rebuild caffe-fast-rcnn after merging.

Hi @manipopopo
I have successfully compiled the merged Caffe.
But when I test the training speed om VGG16, I found the training speed is around 1.214s / iteration, which is not faster comparing cuDNN v3 and no-cuDNN implementation.
Is it normal?

I'm sorry I can't share you with the precise time one iteration takes. I don't have 1080 at hand. But I vaguely remembered it took about 13 seconds for 20 iterations when I trained ResNet-101 (GTX 1080, cuda 8, cudnn 5) using end-to-end strategy a month ago.

@manipopopo i use 1080P to test the demo images, the prcise time as below:

Demo for data/demo/000456.jpg
Detection took 0.107s for 300 object proposals

Demo for data/demo/000542.jpg
Detection took 0.077s for 161 object proposals

Demo for data/demo/001150.jpg
Detection took 0.089s for 194 object proposals

Demo for data/demo/001763.jpg
Detection took 0.089s for 196 object proposals

Demo for data/demo/004545.jpg
Detection took 0.104s for 300 object proposals

@zimenglan-sysu-512 That's really fast!
My detection speed is 0.260s in K80 machine (VGG16)

@zimenglan-sysu-512
I vaguely remembered it took about 190 ms for 300 proposals per image for ResNet-101 (GTX 1080, cuda 8, cudnn 5) during the test phase.

for those who are using windows caffe, here is a fork that support cudnnv5
https://github.com/TadaoYamaoka/caffe/tree/windows

For more information, refer to:
http://tadaoyamaoka.hatenablog.com/entry/2016/06/19/225038

@manipopopo when I run git merge caffe/master It show that:

root@duan:/home/duan/py-faster-rcnn/caffe-fast-rcnn# git merge caffe/mastererror: Your local changes to the following files would be overwritten by merge:
data/cifar10/get_cifar10.sh
data/ilsvrc12/get_ilsvrc_aux.sh
data/mnist/get_mnist.sh
examples/cifar10/create_cifar10.sh
examples/cifar10/train_full.sh
examples/cifar10/train_full_sigmoid.sh
examples/cifar10/train_full_sigmoid_bn.sh
examples/cifar10/train_quick.sh
examples/imagenet/create_imagenet.sh
examples/imagenet/resume_training.sh
examples/imagenet/train_caffenet.sh
examples/mnist/create_mnist.sh
examples/mnist/train_lenet.sh
examples/mnist/train_lenet_adam.sh
examples/mnist/train_lenet_consolidated.sh
examples/mnist/train_lenet_rmsprop.sh
examples/mnist/train_mnist_autoencoder.sh
examples/mnist/train_mnist_autoencoder_adadelta.sh
examples/mnist/train_mnist_autoencoder_adagrad.sh
examples/mnist/train_mnist_autoencoder_nesterov.sh
examples/siamese/create_mnist_siamese.sh
examples/siamese/train_mnist_siamese.sh
python/draw_net.py
scripts/cpp_lint.py
scripts/download_model_binary.py
scripts/travis/travis_build_and_test.sh
scripts/travis/travis_install.sh
scripts/travis/travis_setup_makefile_config.sh
tools/extra/parse_log.py
tools/extra/plot_training_log.py.example
Please, commit your changes or stash them before you can merge.
Aborting

what should i do?

As it said, you should commit your changes or stash them before you can merge. You can try

  1. Use git stash to save your local changes before merging. Afterwards, you can use git stash pop to apply the saved changes on the working directory.
  2. Use git commit -a to commit all the changes before merging.

@manipopopo I am using ubuntu16.04+GTX1080+cuda8.0RC+cudnn v5 and tried your method. After make -j8, it gives me

PROTOC src/caffe/proto/caffe.proto
CXX src/caffe/common.cpp
CXX src/caffe/blob.cpp
CXX src/caffe/layer_factory.cpp
......
CXX src/caffe/syncedmem.cpp
CXX src/caffe/internal_thread.cpp
CXX src/caffe/net.cpp
NVCC src/caffe/solvers/adadelta_solver.cu
NVCC src/caffe/solvers/adam_solver.cu
NVCC src/caffe/solvers/rmsprop_solver.cu
......
NVCC src/caffe/layers/prelu_layer.cu
NVCC src/caffe/layers/threshold_layer.cu
NVCC src/caffe/layers/base_data_layer.cu
CXX/LD -o .build_release/tools/net_speed_benchmark.bin
CXX/LD -o .build_release/tools/test_net.bin
CXX/LD -o .build_release/tools/convert_imageset.bin
CXX/LD -o .build_release/tools/extract_features.bin
CXX/LD -o .build_release/tools/device_query.bin
CXX/LD -o .build_release/tools/train_net.bin
CXX/LD -o .build_release/tools/compute_image_mean.bin
CXX/LD -o .build_release/tools/caffe.bin
CXX/LD -o .build_release/tools/upgrade_solver_proto_text.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin
CXX/LD -o .build_release/tools/finetune_net.bin
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
collect2: error: ld returned 1 exit status
.build_release/lib/libcaffe.so: undefined reference to Makefile:619: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1
make: *** Waiting for unfinished jobs....
`cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/convert_imageset.bin' failed
make: *** [.build_release/tools/convert_imageset.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std:.:__cxx11::basic_string<char, std::char_traits<char>, std::build_release/lib/libcaffe.so: undefined referenceallocator <char> > toconst `cv::imencode(std::__cxx11::basic_string<char, std&::char_traits<char>,, std::allocator<char> >  const&, cv::_InputArray constcv::_InputArray const&, std::vector<unsigned char, std::allocator&<unsigned char> >, std::vector<unsigned char, std::allocator&<unsigned char> ,> std::vector<int, std::allocator<int> &> const&)'
.build_release/lib/,libcaffe.so : undefined reference stdto `cv::imread(std:::__cxx11::basic_string<:char, std::vectorchar_traits<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char>, <std::charallocator, std::char_traits<char>, std::allocator<char> > const&, int)'
<char> > const&, int)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/compute_image_mean.bin' failed
make: *** [.build_release/tools/compute_image_mean.bin] Error 1
Makefile:619: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

@longwoo
Have you uncommented `OPENCV_VERSION := 3ˋ from Makefile.config?

@manipopopo Thanks. So we have to use opencv3 in this case? I am trying to install opencv3 and rebuild again. By the way, here is my Makefile.config.

USE_CUDNN := 1
CUDA_DIR := /usr/local/cuda
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
            -gencode arch=compute_20,code=sm_21 \
            -gencode arch=compute_30,code=sm_30 \
            -gencode arch=compute_35,code=sm_35 \
            -gencode arch=compute_50,code=sm_50 \
            -gencode arch=compute_50,code=compute_50

BLAS := atlas

ANACONDA_HOME := $(HOME)/anaconda2
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
             $(ANACONDA_HOME)/include/python2.7 \
             $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

PYTHON_LIB := $(ANACONDA_HOME)/lib

WITH_PYTHON_LAYER := 1

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

TEST_GPUID := 0

Q ?= @

I'm not sure but opencv 2 should be OK.

I didn't know what version your opencv is, so I guessed that you're using 3. The default Makefile is for opencv 2. If you want to build caffe with OpenCV 3, you'll need to uncomment ˋOPENCV_VERSION := 3ˋ. Otherwise you'll see the error messages you post.

@longwoo by the way, your CUDA_Arch should be set to compute_61 for gtx 1080 card

@manipopopo Yes,opencv 2 is OK .Thanks.
@austingg compute_61 solves the problem. Thank you.

USE_CUDNN := 1

CUDA_DIR := /usr/local/cuda
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
    -gencode arch=compute_20,code=sm_21 \
    -gencode arch=compute_30,code=sm_30 \
    -gencode arch=compute_35,code=sm_35 \
    -gencode arch=compute_50,code=sm_50 \
    -gencode arch=compute_61,code=sm_61 \
    -gencode arch=compute_61,code=compute_61

BLAS := atlas

PYTHON_INCLUDE := /usr/include/python2.7 \
        /usr/lib/python2.7/dist-packages/numpy/core/include
PYTHON_LIB := /usr/lib
WITH_PYTHON_LAYER := 1

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

TEST_GPUID := 0

Q ?= @

@longwoo By the way, if you only develop on 1080 gpu, you can comment other compute capacity, which will make a faster compile speed.

Hi,

Can someone comment on the performance of using py-faster-rcnn with following (or similar) setup:
CUDA version: 8.0
cudnn version: 5.0.5
GPU: Nvidia 1080 Pascal architecture

My previous setup of original py-faster-rcnn (i.e. without merging it with latest caffe) used to train at least twice as fast on CUDA-7.5, cudnn-3.0 and Nvidia TitanX Maxwell architecture.

Is there any FP16 computation going on in there which is slower on 1080 as compared to TitanX ?

@manipopopo Thanks for your guide, but one question, I don‘t know how to 'git commit' before I can use 'git merge'. Can you tell the details?

@Aspirinkb
You only need to do git commit or git stash when you made some changes.
If not, you can simply run git merge

@GBJim I just git stash but some tips come out saying some files needs merge and some files unmerged, and fatal: git-write-tree: error building trees, Cannot save the current index state.

@Aspirinkb

I found a solution from StackOverflow for you
Have you tried git merge --abort to solve this git issue?

@GBJim Yes, I sudo git merge --abort caffe/master and nothing replay. So what should I do next to fix the issue about caffe and cuDNN? step by step? Thanks

@Aspirinkb:
I ain't no Git expert, but I suggest you try this

When I ruined my git project and unable to fix it. I will try to reverse my changes.
If nothing works, the worst case is to delete the whole folder and do everything again.

Hi @Aspirinkb ,

... how to 'git commit' before I can use 'git merge' ...

Use git status to show the status of the directory.
You may see

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

Apply git add or git checkout -- on all files listed on the _Changes not staged for commit_ block, and then run git commit.

After that, you can merge caffe master branch.

You may want to read Git Basics or Try Git.

Hi @ravikantb,

As far as I know, there is no FP16 computation.
This comment showed the elapsed time for the demo.py.

@manipopopo : Thanks for the info. After a rebuild with latest caffe code and latest py-faster-rcnn code now I am also getting similar execution times. Following is a sample of my execution times for anyone looking for it:

Detection took 0.113s for 300 object proposals
Detection took 0.224s for 300 object proposals
Detection took 0.336s for 300 object proposals
Detection took 0.449s for 300 object proposals
Detection took 0.560s for 288 object proposals
Detection took 0.670s for 283 object proposals
Detection took 0.780s for 292 object proposals
Detection took 0.893s for 300 object proposals
Detection took 1.005s for 300 object proposals
Detection took 1.117s for 300 object proposals

Note that these are times for a batch of 10 images split from a single image, hence the time seems increasing. To get actual time for a single batch subtract the time of previous batch from current batch's time. These times were calculated using original VGG16 finetuned on my own dataset. I am also training a resnet-50. In case someone wants, i can share its timing also for reference.

Cheers :)

@manipopopo Hi ! can you share your FasterRCNN+Resnet101 train.prototxt? Thanks a lot!

Hi @Sundrops ,

I'm sorry I can't share the prototxt with you. Currently I have no permission to access the files.
You might want to check #62. There are some ResNet-FasterRCNN prototxts.

@manipopopo ok,thanks all the same.

@manipopopo Hi
I got stuck in 'git merge caffe/master' like this:
'Automatic merge failed; fix conflicts and then commit the result.'
Could you please help me?
Thanks a lot!

Hi @gy1874 ,

You can use git status to see which files conflicts with caffe/master, and follow the instructions here to resolve conflicts.

@manipopopo Thanks!

I did the merge:

https://github.com/TheTesla/caffe-fast-rcnn

I needed to checkout _faster-rcnn-upstream-33f2445_ of _caffe-faster-rcnn_ first to merge it with _master_ of the original _caffe_

Hi~ Thanks a lot, I merged the new caffe, and can use my poor GeForce GTX 560 with CUDA 8.0 now.

But I got an error while running ./tools/demo.py:

Loaded network /home/haoyu/Workspace/PycharmProjects/py-faster-rcnn/data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel
F0111 11:17:13.599874 16491 relu_layer.cu:26] Check failed: error == cudaSuccess (9 vs. 0)  invalid configuration argument
*** Check failure stack trace: ***
[1]    16491 abort (core dumped)  ./tools/demo.py

But if I use ./tools/demo.py --cpu , it works fine.

Loaded network /home/haoyu/Workspace/PycharmProjects/py-faster-rcnn/data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for data/demo/000456.jpg
Detection took 16.195s for 300 object proposals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for data/demo/000542.jpg
Detection took 16.524s for 300 object proposals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for data/demo/001150.jpg
Detection took 16.133s for 300 object proposals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for data/demo/001763.jpg
Detection took 16.114s for 300 object proposals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for data/demo/004545.jpg
Detection took 16.705s for 300 object proposals

Anyone can help me?

!!THX!!

Hi, I merged the new caffe too and am using Titan X Pascal with a similar Makefile as the one above, but when I try to run demo.py I get the following error

screenshot from 2017-01-17 10 27 50

Before running git stash I got a different error:
screenshot from 2017-01-17 10 29 39

@jinyu121 I think CUDA 8.0 doesn't support GTX 560.

Hi @thomasSve,

You'll need to remove self_.attr("phase") = static_cast<int>(this->phase_); from caffe-fast-rcnn/include/caffe/layers/python_layer.hpp after merging. Then make py again.

Hi @manipopopo

yeah I tried that earlier. After trying many different things I basically deleted the caffe folder, did git submodule update --init --recursive to get it back and performed the merge again and now it successfully ran. Thanks

Hi @manipopopo
I use GTX 1080 and cuDNN v4.
and I use modified caffe from LocNet (github.com/gidariss/LocNet).
But when i build caffe and make runtest, i got the error below:

[ FAILED ] 5 tests, listed below:
[ FAILED ] CuDNNConvolutionLayerTest/0.TestSimpleConvolutionCuDNN, where TypeParam = float
[ FAILED ] CuDNNConvolutionLayerTest/0.TestGradientCuDNN, where TypeParam = float
[ FAILED ] CuDNNConvolutionLayerTest/0.TestGradientGroupCuDNN, where TypeParam = float
[ FAILED ] CuDNNConvolutionLayerTest/0.TestSobelConvolutionCuDNN, where TypeParam = float
[ FAILED ] CuDNNConvolutionLayerTest/0.TestSimpleConvolutionGroupCuDNN, where TypeParam = float

I like to solve this problem.
I followed your instruction, but i got stuck in 'git merge caffe/master'.
and terminal shows me message:

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address

what should i do?

@sskim91

* Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"

You'll need to run something like
git config user.email sskim91@___.___
git config user.name sskim91

See here for further information.

@manipopopo , Thank you.

As you mentioned, i followed the git config, and git merge caffe/master.
After that, merge conflict occurred, and resolved it according to your instruction above, and removed self_.attr("phase") = static_cast<int>(this->phase_);.
And i build caffe, but i got error below:
caffe.proto:401:58: Field number 140 has already been used in "caffe.LayerParameter" by field "elu_param".

How do i resolve this problem?

@sskim91
You'll need to make sure all the tags within a message are unique.

As the error message says, optional RegionPoolingParameter region_pooling_param = 140; from caffe_LocNet is in conflict with optional ELUParameter elu_param = 140; from caffe. Replace region_pooling_param = 140; with something like region_pooling_param = 5566;.

See here to learn more about protobuf.

currently by using

cd caffe-fast-rcnn  
git remote add caffe https://github.com/BVLC/caffe.git  
git fetch caffe  
git merge caffe/master  

will meet conflicts issue:

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:      LICENSE
        both modified:      python/caffe/__init__.py
        both modified:      python/caffe/_caffe.cpp

it needs to manually handle __init__,py and _caffe.cpp
somethin like this
image

@Asiapenolove I met this problem several days ago.

You can ignore README, and use the newest code.

But! If you do so, there will be bugs while make test .

I'm getting make errors when using the newest code using the following command:
make all -j4

The errors are the following:

.build_release/lib/libcaffe.so: undefined reference to `cv::String::allocate(unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint64Fallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(google::protobuf::io::CodedInputStream*, unsigned int, bool (*)(int), google::protobuf::UnknownFieldSet*, google::protobuf::RepeatedField<int>*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32SlowPath(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::CheckEntireMessageConsumedAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, int, int, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::MergeFromFail(char const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::deallocate()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::UnknownFieldSet::MergeToInternalMetdata(google::protobuf::UnknownFieldSet const&, google::protobuf::internal::InternalMetadataWithArena*)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadLengthAndPushLimit()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1
make: *** Waiting for unfinished jobs....
.build_release/lib/libcaffe.so: undefined reference to `cv::String::allocate(unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint64Fallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(google::protobuf::io::CodedInputStream*, unsigned int, bool (*)(int), google::protobuf::UnknownFieldSet*, google::protobuf::RepeatedField<int>*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32SlowPath(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::CheckEntireMessageConsumedAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, int, int, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::MergeFromFail(char const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::deallocate()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::UnknownFieldSet::MergeToInternalMetdata(google::protobuf::UnknownFieldSet const&, google::protobuf::internal::InternalMetadataWithArena*)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadLengthAndPushLimit()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
.build_release/tools/caffe.o: In function `train()':
caffe.cpp:(.text+0x2afd): undefined reference to `google::protobuf::Arena::AllocateAligned(std::type_info const*, unsigned long)'
caffe.cpp:(.text+0x2b2b): undefined reference to `google::protobuf::Arena::AddListNode(void*, void (*)(void*))'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::allocate(unsigned long)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint64Fallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::IncrementRecursionDepthAndPushLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns(google::protobuf::io::CodedInputStream*, unsigned int, bool (*)(int), google::protobuf::UnknownFieldSet*, google::protobuf::RepeatedField<int>*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarint32Fallback(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteVarint32SlowPath(unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::CheckEntireMessageConsumedAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(google::protobuf::Descriptor const*, google::protobuf::Message const*, int const*, int, int, int, int, int, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadVarintSizeAsIntFallback()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::MergeFromFail(char const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::DecrementRecursionDepthAndPopLimit(int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::String::deallocate()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::UnknownFieldSet::MergeToInternalMetdata(google::protobuf::UnknownFieldSet const&, google::protobuf::internal::InternalMetadataWithArena*)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadLengthAndPushLimit()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1

Hi,

I am trying to build py-faster-rcnn on ubuntu 16.04, using tesla k20c, cudnn: v5. (cuda 8).

This is what I have done:
In Makefile.config:
uncommented the USE_CUDNN:=1 (as without this I am to build it, but only able to run the ./tools/demo.py --cpu , but the default (--gpu) gives the following error).

I0321 16:44:53.692109 26971 net.cpp:744] Ignoring source layer data
I0321 16:44:53.758460 26971 net.cpp:744] Ignoring source layer drop6
I0321 16:44:53.767998 26971 net.cpp:744] Ignoring source layer drop7
I0321 16:44:53.768015 26971 net.cpp:744] Ignoring source layer fc7_drop7_0_split
I0321 16:44:53.768318 26971 net.cpp:744] Ignoring source layer loss_cls
I0321 16:44:53.768327 26971 net.cpp:744] Ignoring source layer loss_bbox
I0321 16:44:53.769767 26971 net.cpp:744] Ignoring source layer silence_rpn_cls_score
I0321 16:44:53.769780 26971 net.cpp:744] Ignoring source layer silence_rpn_bbox_pred


Loaded network $FRCN_ROOT/data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel
F0321 16:44:54.035586 26971 syncedmem.cpp:71] Check failed: error == cudaSuccess (2 vs. 0)  out of memory
*** Check failure stack trace: ***
Aborted (core dumped)

But I need performance as I am working on a video dataset, so I have to build it using "USE_CUDNN:=1"

Also, I have merged caffe-fater-rcnn with caffe/master build and removed the line: self_.attr("phase") = static_cast<int>(this->phase_) as mentioned in the previous posts. And tried to rebuild.

At the very end I get this following error:

CXX/LD -o .build_release/tools/test_net.bin
CXX/LD -o .build_release/tools/upgrade_solver_proto_text.bin
CXX/LD -o .build_release/tools/train_net.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
CXX/LD -o .build_release/tools/device_query.bin
CXX/LD -o .build_release/tools/net_speed_benchmark.bin
CXX/LD -o .build_release/tools/finetune_net.bin
CXX/LD -o .build_release/tools/convert_imageset.bin
CXX/LD -o .build_release/tools/compute_image_mean.bin
CXX/LD -o .build_release/tools/extract_features.bin
CXX/LD -o .build_release/tools/upgrade_net_proto_binary.bin
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
make: *** Waiting for unfinished jobs....
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_solver_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_solver_proto_text.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/compute_image_mean.bin' failed
make: *** [.build_release/tools/compute_image_mean.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/convert_imageset.bin' failed
make: *** [.build_release/tools/convert_imageset.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetActivationDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateActivationDescriptor'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

I am not sure what library is cudnnSetActivationDescriptor' andcudnnCreateActivationDescriptor' that it's not able to find. I tried to look for this error but didn't find anything useful.

Does anyone know how this can be fixed?

Thanks,

@manipopopo
PLease after I did your step regarding caffe,
when I ((sudo make -j4 && make pycaffe))
I faced this error:

touch python/caffe/proto/__init__.py
touch: cannot touch 'python/caffe/proto/__init__.py': Permission denied
Makefile:647: recipe for target 'python/caffe/proto/__init__.py' failed
make: * [python/caffe/proto/__init__.py] Error 1

@hana9090
I have no idea why it happens. 😿
Could you use

make -j4
make pycaffe

or

sudo make -j4
sudo make pycaffe

instead?

still have same error :\

@hana9090
I got the same error when I ran

sudo make
make pycaffe

After that I ran sudo make pycaffe, it works without error.

You may want to try something like
```
sudo make clean
make
make pycaffe

@manipopopo
I did what you write, but still have the same error of permission denied.
Although I change the permission of /proto/ directory from root to user!

@manipopopo
Thank you :)
it worked with me if I arrange them as following:

sudo make clean
make pycaffe
make -j8

Made it work with pascal:

Clone this and compile then

https://github.com/soulslicer/caffe-fast-rcnn

Just change proposal_layer.py

     def setup(self, bottom, top):
         # parse the layer parameter string, which must be valid YAML
-        layer_params = yaml.load(self.param_str_)
+        layer_params = yaml.load(self.param_str)

         self._feat_stride = layer_params['feat_stride']
         anchor_scales = layer_params.get('scales', (8, 16, 32))
@@ -61,7 +61,7 @@ class ProposalLayer(caffe.Layer):
         assert bottom[0].data.shape[0] == 1, \
             'Only single item batches are supported'

-        cfg_key = str(self.phase) # either 'TRAIN' or 'TEST'
+        cfg_key = 'TEST' if self.phase == 1 else 'TRAIN'

@manipopopo hi, I followed your instructions but met the error below while make pytest

======================================================================

ERROR: test_backward (test_python_layer_with_param_str.TestLayerWithParam)

Traceback (most recent call last):
File "/home/lid/py-faster-rcnn/caffe-fast-rcnn/python/caffe/test/test_python_layer_with_param_str.py", line 46, in setUp
self.net = caffe.Net(net_file, caffe.TRAIN)
File "/home/lid/py-faster-rcnn/caffe-fast-rcnn/python/caffe/test/test_python_layer_with_param_str.py", line 14, in setup
self.value = float(self.param_str)
AttributeError: 'SimpleParamLayer' object has no attribute 'param_str'

======================================================================

ERROR: test_forward (test_python_layer_with_param_str.TestLayerWithParam)

Traceback (most recent call last):
File "/home/lid/py-faster-rcnn/caffe-fast-rcnn/python/caffe/test/test_python_layer_with_param_str.py", line 46, in setUp
self.net = caffe.Net(net_file, caffe.TRAIN)
File "/home/lid/py-faster-rcnn/caffe-fast-rcnn/python/caffe/test/test_python_layer_with_param_str.py", line 14, in setup
self.value = float(self.param_str)
AttributeError: 'SimpleParamLayer' object has no attribute 'param_str'


Ran 51 tests in 10.025s

FAILED (errors=2)
Makefile:536: recipe for target 'pytest' failed
make: * [pytest] Error 1

Could you please help me?

You can ignore make pytest for the present. It doesn't affect py-faster-rcnn.

@manipopopo Thanks a lot, I run the demo.py afterwards and it passed the test, maybe make pytest is definately meaningless in some sense, but my motivation is just to find out what happened.

I think this issue should be kept open.

manipopopo's suggestion works, but still it should be fixed by py-faster-rcnn.

@manipopopo Thanks a lot mate! great !

the method of merge and rebuild caffe works! ./tools/demo.py runs fluently, and the train with ./experiments/scripts/faster_rcnn_end2end.sh runs! but after I changed the train.prototxt, just replace the full connected layers with only one full connected layer and add two conv layer after the pretrained backbone network, and then train again, it prompts Error parsing text-format caffe.NetParameter: 1:3: Message type "caffe.NetParameter" has no field named "me"

For folks who are starting to look into this, give this fork a try. Hopefully, it would help you skip a few steps.

https://github.com/vgupta-ai/py-faster-rcnn

@manipopopo
I follow your steps for my setup
UBUNTU 17.10
CUDA 8
CUDNN 5

But When I run the demo I have error
I0410 12:13:10.739405 81877 net.cpp:380] conv1_1 -> conv1_1
F0410 12:13:10.898735 81877 cudnn_conv_layer.cpp:53] Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR
* Check failure stack trace: *
Aborted (core dumped)

@hana9090
I tested it again and got no errors.
Are there any processes using the gpu?
Maybe you could search status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR.

@manipopopo
I download new faster and build again your steps. I have same error :(
How to search about this error? or this status?
Please help

nvidia-smi
Tue Apr 10 16:03:28 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.125 Driver Version: 384.125 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Tesla K80 Off | 00003F47:00:00.0 Off | 0 |
| N/A 42C P0 57W / 149W | 0MiB / 11439MiB | 0% Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+

@hana9090
I can't reproduce the problem on my computer. (CUDA 9.1, cuDNN 7)
Maybe you could google status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR.
It seems that the error is unrelated to py-faster-rcnn.

@manipopopo
Thank you it works :)
I just have to run the demo with sudo

@manipopopo thanks for the steps. I got my through all the make problems.

However, when I run tools/demo.py then I got this error:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0526 23:23:06.432446 25676 _caffe.cpp:139] DEPRECATION WARNING - deprecated use of Python interface
W0526 23:23:06.432467 25676 _caffe.cpp:140] Use this instead (with the named "weights" parameter):
W0526 23:23:06.432471 25676 _caffe.cpp:142] Net('/home/wli/codes/py-faster-rcnn/models/pascal_voc/VGG16/faster_rcnn_alt_opt/faster_rcnn_test.pt', 1, weights='/home/wli/codes/py-faster-rcnn/data/faster_rcnn_models/VGG16_faster_rcnn_final.caffemodel')
[libprotobuf ERROR google/protobuf/text_format.cc:274] Error parsing text-format caffe.NetParameter: 350:21: Message type "caffe.LayerParameter" has no field named "roi_pooling_param".
F0526 23:23:06.433696 25676 upgrade_proto.cpp:90] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/wli/codes/py-faster-rcnn/models/pascal_voc/VGG16/faster_rcnn_alt_opt/faster_rcnn_test.pt
* Check failure stack trace: *
Aborted (core dumped)

Any thoughts on how to fix this? much appreciated!

Was this page helpful?
0 / 5 - 0 ratings