Problem with caffe:Net() to read proto file

1,491 views
Skip to first unread message

Z

unread,
Mar 18, 2015, 11:45:29 PM3/18/15
to caffe...@googlegroups.com
I just updated the latest Caffe source code, and my original code cannot work (for example, the input is /examples/mnist/lenet_train_test.prototxt):

 " caffe::NetParameter params;
   caffe::ReadNetParamsFromTextFileOrDie(net_proto, &params);
   caffe::Net<float> net(params);"

The error message is always like
" layer_factory.hpp:74] Creating layer bsd_l
  layer_factory.hpp:77] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Data (known types: )".

I know it is due to layer type of "Data" cannot be found. But if I rolled back to the old Caffe library, it works.

So what's happening to the latest Caffe code? What solution should I take to this problem?
Could somebody here help me with this?

Thanks.

Charon Zhai

unread,
Mar 19, 2015, 1:59:05 AM3/19/15
to caffe...@googlegroups.com
I think you should check what type of .prototxt you were using (like v0 or v1). Check upgrade_proto.cpp. I think maybe you're using "Data" in old version of prototxt, where in old version "Data" should be "DATA" or "data". Hope this helps.

Z

unread,
Mar 19, 2015, 2:09:05 AM3/19/15
to caffe...@googlegroups.com
I used new version proto (such as ./examples/mnist/lenet_train_test.prototxt or lenet.prototxt with the latest Caffe), and the error was produced. And I tried several protos, and all of them failed with message "Unknown layer type".

I don't know if it is related to my running environment or there is something changed in Caffe.

Thank you.

Z

unread,
Mar 19, 2015, 4:47:36 AM3/19/15
to caffe...@googlegroups.com
The problem solved.

I just switched to link against 'libcaffe.so' instead of its static twins 'libcaffe.a', and my codes run without error message.

But I cannot understand why linkage to 'libcaffe.a' makes error in the latest Caffe, while in the old Caffe linkage to 'libcaffe.a' did not make any problem.

So what's the difference between 'libcaffe.a' and 'libcaffe.so'? Is the difference only that one is dynamic and the other is static?

fuziluo

unread,
Jun 9, 2015, 4:40:52 AM6/9/15
to caffe...@googlegroups.com
I have the same problem and I think I also managed to link against 'libcaffe.so', by changing something in Makefile. Following a part of the output from make all.

g++ build/debug/tools/caffe.o build/debug/lib/libcaffe.so -o build/debug/tools/caffe.bin -fPIC -std=c++11 -Ofast -march=native -DDEBUG -g -DCPU_ONLY -DUSE_OPENCL -DCAFFE_OPENCL_VERSION="0.1" -DOPENCL_OPT_LEVEL=1 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I/usr/include/hdf5/serial/ -Ibuild/debug/src -I./src -I./include -I/opt/AMDAPPSDK-3.0-0-Beta/include -I/opt/clBLAS-2.4.0-Linux-x64/include -I/home/robert/workspace/OpenBLAS/build/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -L/opt/AMDAPPSDK-3.0-0-Beta/lib/x86_64 -L/opt/AMDAPPSDK-3.0-0-Beta/lib/x86_64/sdk -L/opt/AMDAPPSDK-3.0-0-Beta/lib64 -L/opt/AMDAPPSDK-3.0-0-Beta/lib/x86 -L/usr/lib -L/opt/clBLAS-2.4.0-Linux-x64/lib64 -L/usr/lib -lOpenCL -lclBLAS -lboost_regex -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lpthread -lboost_thread -lcblas -latlas

And this the error message
I0607 00:24:12.260156  3593 net.cpp:67] Memory required for data: 0
I0607 00:24:12.260167  3593 layer_factory.hpp:75] Creating layer mnist
F0607 00:24:12.260180  3593 layer_factory.hpp:79] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Data (known types: )
*** Check failure stack trace: ***
    @     0x7fe7f99a1ea4  (unknown)
    @     0x7fe7f99a1deb  (unknown)
    @     0x7fe7f99a17bf  (unknown)
    @     0x7fe7f99a4a35  (unknown)
    @           0x494fb5  caffe::LayerRegistry<>::CreateLayer()
    @           0x49725a  caffe::Net<>::Init()
    @           0x499c35  caffe::Net<>::Net()
    @           0x4a9d8b  caffe::Solver<>::InitTrainNet()
    @           0x4aa3b0  caffe::Solver<>::Init()
    @           0x4aa5a6  caffe::Solver<>::Solver()
    @           0x420af0  caffe::GetSolver<>()
    @           0x418b25  train()
    @           0x41465b  main
    @     0x7fe7f76c4a40  (unknown)
    @           0x415ac9  _start
    @              (nil)  (unknown)
Aborted (core dumped)
Any idea what's wrong? 
Reply all
Reply to author
Forward
0 new messages