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

Issue while creating models even though the project is built #4

Closed
smartinsert opened this issue Apr 19, 2016 · 7 comments
Closed

Issue while creating models even though the project is built #4

smartinsert opened this issue Apr 19, 2016 · 7 comments

Comments

@smartinsert
Copy link

smartinsert commented Apr 19, 2016

Hi,

I am trying to replicate your work using caffe, but am encountering the following issue when i try to create a model.

The ssai.so has been build and is stored in the following path:
/home/ubuntu/src/ssai/lib/build/ssai.so

I am running the following command to create the models:
$ python scripts/create_models.py --seed seeds/model_seeds.json --caffe_dir $HOME/src/caffe/

and i get the following stack trace:

ubuntu@ip-172-31-30-95:~/src/ssai$ python scripts/create_models.py --seed seeds/model_seeds.json --caffe_dir $HOME/src/caffe/
Namespace(batch_size=128, caffe_dir='/home/ubuntu/src/caffe/', crop_size=64, dataset_backend='lmdb', seed='seeds/model_seeds.json')
/home/ubuntu/src/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptrcaffe::Net already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
/home/ubuntu/src/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptrcaffe::Blob already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
/home/ubuntu/src/caffe/python/caffe/pycaffe.py:13: RuntimeWarning: to-Python converter for boost::shared_ptrcaffe::Solver already registered; second conversion method ignored.
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
Traceback (most recent call last):
File "/home/ubuntu/src/caffe//python/draw_net.py", line 45, in
main()
File "/home/ubuntu/src/caffe//python/draw_net.py", line 39, in main
text_format.Merge(open(args.input_net_proto_file).read(), net)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 265, in Merge
return MergeLines(text.split('\n'), message)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 298, in MergeLines
_ParseOrMerge(lines, message, True)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 229, in _ParseOrMerge
_MergeField(tokenizer, message, allow_multiple_scalars)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 382, in _MergeField
_MergeField(tokenizer, sub_message, allow_multiple_scalars)
File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 356, in _MergeField
message_descriptor.full_name, name))
google.protobuf.text_format.ParseError: 53:3 : Message type "caffe.LayerParameter" has no field named "patch_transformer_param".
Traceback (most recent call last):
File "scripts/create_models.py", line 611, in
'models/%s/net.png' % model_name])
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['python', '/home/ubuntu/src/caffe//python/draw_net.py', u'models/VGG_PReLU_Roads/train_test.prototxt', u'models/VGG_PReLU_Roads/net.png']' returned non-zero exit status 1

Note: I was doing this while the data download was in the progress with the bash shell/

Kindly help.

@mitmul
Copy link
Owner

mitmul commented Apr 19, 2016

It seems you didn't use my modified Caffe. As the error message says, my codes cannot be run with original Caffe because it needs PatchTransformer layer.

@smartinsert
Copy link
Author

smartinsert commented Apr 19, 2016

Thank you for your suggestion.
However, when your modified caffe version in the CPU only mode with the following parameters.
CPU_ONLY := 1
CUDA_DIR := /usr
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
PYTHON_INCLUDE := /usr/include/python2.7
/usr/lib/python2.7/dist-packages/numpy/core/include
PYTHON_LIB := /usr/lib
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
DEBUG := 1
TEST_GPUID := 0
Q ?= @

I get the following error:
In file included from ./include/caffe/common.hpp:19:0,
from ./include/caffe/blob.hpp:8,
from ./include/caffe/layer.hpp:8,
from src/caffe/layers/softmax_cross_entropy_loss_layer.cpp:6:
./include/caffe/util/device_alternate.hpp:15:36: error: no ‘void caffe::SoftmaxCrossEntropyLossLayer::Forward_gpu(const std::vectorcaffe::Blob<Dtype_>&, const std::vectorcaffe::Blob<Dtype_>&)’ member function declared in class ‘caffe::SoftmaxCrossEntropyLossLayer’
const vector<Blob>& top) { NO_GPU; }
^
src/caffe/layers/softmax_cross_entropy_loss_layer.cpp:181:1: note: in expansion of macro ‘STUB_GPU’
STUB_GPU(SoftmaxCrossEntropyLossLayer);
^
./include/caffe/util/device_alternate.hpp:19:39: error: no ‘void caffe::SoftmaxCrossEntropyLossLayer::Backward_gpu(const std::vectorcaffe::Blob<Dtype
>&, const std::vector&, const std::vectorcaffe::Blob<Dtype_>&)’ member function declared in class ‘caffe::SoftmaxCrossEntropyLossLayer’
const vector<Blob_>& bottom) { NO_GPU; }
^
src/caffe/layers/softmax_cross_entropy_loss_layer.cpp:181:1: note: in expansion of macro ‘STUB_GPU’
STUB_GPU(SoftmaxCrossEntropyLossLayer);
^
make: *** [.build_debug/src/caffe/layers/softmax_cross_entropy_loss_layer.o] Error 1

This is the code where it fails:
180 #ifdef CPU_ONLY
181 STUB_GPU(SoftmaxCrossEntropyLossLayer);
182 #endif // ifdef CPU_ONLY

The original version of caffe however build without any issue.

Please help me figure this out.

Many Thanks !

@mitmul
Copy link
Owner

mitmul commented Apr 19, 2016

Build with GPU or just add declaration of Forward_gpu and Backward_gpu to the corresponding header file. Because, as the error message says, the error caused by the lack of declaration of those methods in the header. STUB_GPU outputs definitions, but doesn't output any declaration to headers.
Please see here:
https://github.com/mitmul/caffe/blob/ssai/include/caffe/util/device_alternate.hpp#L12

@smartinsert
Copy link
Author

The issue is resolved.

Thanks so much.

@mitmul
Copy link
Owner

mitmul commented Apr 20, 2016

Thanks for reporting. I'd really appreciate it if you could share how to resolve it for other people.

@mitmul mitmul closed this as completed Apr 20, 2016
@smartinsert
Copy link
Author

Hi @mitmul, i resolved the above issue by declaring the backward_gpu and backward_cpu in the loss_layer.hpp where the class SoftmaxCrossEntropyLossLayer is declared.

@mitmul
Copy link
Owner

mitmul commented Apr 20, 2016

Thanks @smartinsert , I'm glad to hear my suggestion worked.

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

2 participants