Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault in cpu mode. #28

Open
misery0424 opened this issue Nov 23, 2016 · 12 comments
Open

Segmentation fault in cpu mode. #28

misery0424 opened this issue Nov 23, 2016 · 12 comments

Comments

@misery0424
Copy link

misery0424 commented Nov 23, 2016

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&) ()

@moting9
Copy link

moting9 commented Nov 30, 2016

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

@misery0424
Copy link
Author

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

@dantp-ai
Copy link

dantp-ai commented Dec 5, 2016

@misery0424 Did you run with flag --cpu ?

@mlot
Copy link

mlot commented Dec 21, 2016

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

@liyi14
Copy link
Collaborator

liyi14 commented Dec 22, 2016

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.

eakbas added a commit to eakbas/py-R-FCN that referenced this issue Jul 7, 2017
People spend their time (e.g. compiling caffe) to make this code work in CPU-only mode. However, they get a "Segmentation fault (core dumped)" error  without any further explanation. Due to an issue (YuwenXiong#28), CPU-only mode is currently not available.
@BetterZhouXu
Copy link

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
Copy link

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

@caiyang
Copy link

caiyang commented Sep 28, 2017

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

@BetterZhouXu
Copy link

@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.

@caiyang
Copy link

caiyang commented Sep 30, 2017

@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()); }

@dreadlord1984
Copy link

@caiyang you are right. good job!mark

@Amos6666
Copy link

@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.

ZhuLingfeng1993 added a commit to ZhuLingfeng1993/caffe-for-py-R-FCN that referenced this issue Jan 17, 2019
1.add cpu forward implementation as YuwenXiong/py-R-FCN#28 (comment)
2.add cpu backward implementation by stealing code from its GPU implement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants