py-R-FCN icon indicating copy to clipboard operation
py-R-FCN copied to clipboard

Segmentation fault in cpu mode.

Open misery0424 opened this issue 9 years ago • 12 comments

I have successfully train the rfcn model and test in gpu model. But when i run the demo in cpu model the program will core dump with "Segmentation fault". Can anyone help me about this problem?

the gdb error info is:

#0 0x00007ffff6e44653 in __memcpy_ssse3_back () from /usr/lib64/libc.so.6 #1 0x00007fffe368c848 in caffe::ScaleLayer::Forward_cpu(std::vector<caffe::Blob, std::allocator<caffe::Blob> > const&, std::vector<caffe::Blob, std::allocator<caffe::Blob> > const&) ()

misery0424 avatar Nov 23 '16 07:11 misery0424

I also met with segmentation fault in cpu mode when running demo_rfcn. Have you resolved this issue?

moting9 avatar Nov 30 '16 06:11 moting9

@moting9 I find that the psroi_pooling_layer doesn't implement in CPU.

misery0424 avatar Nov 30 '16 09:11 misery0424

@misery0424 Did you run with flag --cpu ?

dantp-ai avatar Dec 05 '16 20:12 dantp-ai

I run into the same issue, with the following command: demo_rfcn --net ResNet-50 --cpu

mlot avatar Dec 21 '16 17:12 mlot

Hi @misery0424 , It might dut to the fact that we didn't implement forward_cpu of psroipooling. Maybe we can implement it yourself, or only use gpu mode.

liyi14 avatar Dec 22 '16 07:12 liyi14

Do you implement the CPU mode, or can you tell me what should I do if I want to implement the CPU mode, Thanks

BetterZhouXu avatar Jul 14 '17 09:07 BetterZhouXu

@misery0424 @moting9 @plopd @mlot @liyi14 Hello everyone, do you implement the cpu mode in test? If you do, please tell me, thanks!

BetterZhouXu avatar Jul 27 '17 03:07 BetterZhouXu

@misery0424 @moting9 @plopd @mlot @liyi14 did a quick CPU implementation by stealing code from its GPU counterpart: https://github.com/caiyang/caffe-rfcn

caiyang avatar Sep 28 '17 07:09 caiyang

@caiyang I just tried your psroi_pooling_layer, it didn't work and shows "segmentation fault". I used py-r-fcn, what I did is replace your psroi_pooling_leyer.cpp and add file rfcn_layers.hpp. After that, I re-compiled my py-r-fcn, but it didn't work.

BetterZhouXu avatar Sep 28 '17 08:09 BetterZhouXu

@xuxuzhou I believe the problem is a bug in the caffe-ms the py-R-FCN uses. If you remove all layers except for the first conv-bn-scale block and run the demo in cpu mode again, the segmentation fault still exists. The segmentation fault is caused by the Forward_cpu in scale_layer.cpp: caffe_copy(bottom[0]->count(), bottom[0]->cpu_data(), temp_.mutable_cpu_data()); the memory copy source and destination sizes are different(i.e. bottom[0]->count() != temp_.count()), this is because your actual input size is different from the size defined in the deploy.prototxt. You can change the code as follow (as scale_layer.cu did), and recompile caffe, the problem should disappear: const bool scale_param = (bottom.size() == 1); if (!scale_param || (scale_param && this->param_propagate_down_[0])) { caffe_copy(bottom[0]->count(), bottom[0]->cpu_data(), temp_.mutable_cpu_data()); }

caiyang avatar Sep 30 '17 02:09 caiyang

@caiyang you are right. good job!mark

dreadlord1984 avatar Dec 05 '17 10:12 dreadlord1984

@caiyang Hello.I have tried your solution to run r-fcn on cpu mode. It worked, make&make pycaffe&make test all passed successfully. However, when ./tools/demo_rfcn.py --net ResNet-50 --cpu , it shows time every picture used but shows no pictures. While I save the pictures, they are totally white with nothing. Have you ever seen such a situation? I would appreciate if you can help me.

Amos6666 avatar Feb 15 '18 14:02 Amos6666