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

/multi_stage_meanfield.cpp #19

Closed
srika91 opened this issue Jan 10, 2016 · 15 comments
Closed

/multi_stage_meanfield.cpp #19

srika91 opened this issue Jan 10, 2016 · 15 comments

Comments

@srika91
Copy link

srika91 commented Jan 10, 2016

Hello ,

I am trying to build caffe with gpu.Initially while compiling an error was displayed saying "could not find spatial.par ....",so I copy pasted "spatial.par" to the path it compiles and again added "bilateral.par" when it threw error on that as well.These I added from python-scripts available for python users.

When I tried to compile using "make all",I get the following warning,but it compiles all other files neatly.

src/caffe/layers/multi_stage_meanfield.cpp: In instantiation of ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = float]’:
src/caffe/layers/multi_stage_meanfield.cpp:254:1: required from here
src/caffe/layers/multi_stage_meanfield.cpp:68:83: warning: format ‘%lf’ expects argument of type ‘double_’, but argument 3 has type ‘float_’ [-Wformat=]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:83: warning: format ‘%lf’ expects argument of type ‘double_’, but argument 3 has type ‘float_’ [-Wformat=]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp: In member function ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = float]’:
src/caffe/layers/multi_stage_meanfield.cpp:68:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp: In member function ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = double]’:
src/caffe/layers/multi_stage_meanfield.cpp:68:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);

Also during "make runtest" it takes long time to test the file at ,

1 test from MultiStageMeanfieldLayerTest/2, where TypeParam = caffe::FloatGPU
[ RUN ] MultiStageMeanfieldLayerTest/2.TestGradient

Hence I stopped the test.

Once I build this, I will be trying to use the model in torch 7 using torch-caffe-binding.

Sorry for the long post

Regards
srikanth

@bittnt
Copy link
Collaborator

bittnt commented Jan 13, 2016

@srika91 Hi, yep. 1) you need spatial.par bilateral.par files, they allow you to set hyper-weights for class. 2) You should get the stuff running by adding crop layers into the torch-caffe-binding, as there are no crop layer implemented in the caffe upstream, while you can find this on jon's future version caffe or here.

@srika91
Copy link
Author

srika91 commented Jan 26, 2016

thanks for your reply.I cannot figure out how to do it.crop layers should be added in caffe.cpp of torch-caffe-binding?

@bittnt
Copy link
Collaborator

bittnt commented Jan 26, 2016

Not yet, as far as I know. meanwhile, you can take out the crop layers and multi_stage_meanfield layer in the prototxt. Then you should be able to use the torch-caffe-binding.

BVLC/caffe#1976

@JoestarK
Copy link

Did you solve the problem? I got the same warning while compiling.

@srika91
Copy link
Author

srika91 commented Mar 28, 2016

@JoestarK if you are talking about the warnings at the top,I solved by commenting out all the caffe paths in the bash and removed the crfasrnn completely and 'make' again.It solved the problem,but the torch-caffe-binding i cannot figure it out yet.Also the crfasrnn am using is built with caffe in cpu mode which is working fine for me to run demos.Training myself takes long time.

@JoestarK
Copy link

@srika91 Thanks for your reply. But I couldn't find any caffe paths in the bash. And removed the crfasrnn and 'make' again, also showing the warning like this:

src/caffe/layers/multi_stage_meanfield.cpp: In instantiation of ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = float]’:
src/caffe/layers/multi_stage_meanfield.cpp:254:1: required from here
src/caffe/layers/multi_stage_meanfield.cpp:68:83: warning: format ‘%lf’ expects argument of type ‘double_’, but argument 3 has type ‘float_’ [-Wformat=]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:83: warning: format ‘%lf’ expects argument of type ‘double_’, but argument 3 has type ‘float_’ [-Wformat=]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp: In member function ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = float]’:
src/caffe/layers/multi_stage_meanfield.cpp:68:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp: In member function ‘void caffe::MultiStageMeanfieldLayer::LayerSetUp(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&) [with Dtype = double]’:
src/caffe/layers/multi_stage_meanfield.cpp:68:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
^
src/caffe/layers/multi_stage_meanfield.cpp:75:7: warning: ignoring return value of ‘int fscanf(FILE_, const char_, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(pFile, "%lf", &this->blobs_[1]->mutable_cpu_data()[i * channels_ + i]);

@srika91
Copy link
Author

srika91 commented Mar 28, 2016

Do u have PYTHONPATH in bash,pointing to caffe's python?

@JoestarK
Copy link

@srika91 There are just two paths in the bash,one is the CUDA's PATH,another is JAVA‘s

@srika91
Copy link
Author

srika91 commented Mar 28, 2016

Do u have a working caffe,if yes then I dont have idea about ur problem.Bcz in my case i commented out the previous working caffe in bash which had a PYTHONPATH pointing to python folder inside caffe main folder.And I rebuilt caffe from this repo and it worked fine for me.

@JoestarK
Copy link

@srika91 Thanks anyway

@lynetcha
Copy link

Is there a MultiStageMeanfieldLayerTest class for gradient checking available? The error in the first post seems to suggest that but I can't find a test for the CRFasRNN layer in the Caffe code. @srika91

@bittnt
Copy link
Collaborator

bittnt commented Oct 22, 2016

@lynetcha @srika91 gradient check test code is available now. https://github.com/bittnt/caffe

@lynetcha
Copy link

Thanks!

@bittnt bittnt closed this as completed Oct 22, 2016
@PeterJackNaylor
Copy link

PeterJackNaylor commented Nov 24, 2016

Hi,

I think I have the same problem but I don't understand what you did...
But I have added the files bilateral.par and spatial.par to my caffe path.
I have the same warnings:
############
src/caffe/layers/multi_stage_meanfield.cpp:54:13: warning: format ‘%lf’ expects argument of type ‘double*’, but argument 3 has type ‘float*’ [-Wformat=]
fscanf(pFile, "%lf", &this->blobs_[0]->mutable_cpu_data()[i * channels_ + i]);
############
But however, when i run make runtest, it fails at:

############
*** Aborted at 1480011037 (unix time) try "date -d @1480011037" if you are using GNU date ***
PC: @ 0x7ff7655f20b9 caffe::MultiStageMeanfieldLayer<>::Forward_cpu()
*** SIGSEGV (@0x0) received by PID 32138 (TID 0x7ff76c2e5ac0) from PID 0; stack trace: ***
@ 0x7ff764a203e0 (unknown)
@ 0x7ff7655f20b9 caffe::MultiStageMeanfieldLayer<>::Forward_cpu()
@ 0x5115c6 caffe::Layer<>::Forward()
@ 0x8470c0 caffe::MultiStageMeanfieldLayerTest_TestGradient_Test<>::TestBody()
@ 0x9e65e8 testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x9e1737 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x9cd072 testing::Test::Run()
@ 0x9cd864 testing::TestInfo::Run()
@ 0x9cdeaf testing::TestCase::Run()
@ 0x9d335d testing::internal::UnitTestImpl::RunAllTests()
@ 0x9e77c5 testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x9e23e8 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x9d1f6c testing::UnitTest::Run()
@ 0x4c26a4 main
@ 0x7ff764666830 __libc_start_main
@ 0x4c2449 _start
@ 0x0 (unknown)
Segmentation fault (core dumped)

############

What is funnier, is that the error message just above (Aborted etc..) indicates Forward_cpu(), but if i comment out all the code there, I pass each one of the tests!

@bittnt
Copy link
Collaborator

bittnt commented Nov 27, 2016

@PeterJackNaylor you need spatial.par bilateral.par files, they allow you to set hyper-weights for class. These files should present in the script path you run.

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

5 participants