caffe_ssd_踩坑
一
http://blog.csdn.net/sinat_31802439/article/details/52958791
python.config no such file
解决:
1 makeflie文件Python路径正确
2 包含PYTHONPATH(bahsrc)
二
build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory
解决:
-
Go to the libraries directory:
cd /usr/lib/x86_64-linux-gnu
-
Link the system version of HDF5 from 7 to 9:
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so.10 sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so.10
-
Update the "Dynamic Linker":
sudo ldconfig
三
/usr/lib/libopencv_highgui.so.2.4: undefined reference to TIFFRGBAImageOK@LIBTIFF_4.0' 1>
/usr/lib/libopencv_highgui.so.2.4: undefined reference toTIFFReadRGBAStrip@LIBTIFF_4.0'
解决方式前面说了,就是编译opencv的时候要加上 -D BUILD_TIFF=ON
然后又出现了这个错误,这个错误曾让我苦恼了两天,还因此把系统搞崩溃一次....不得不重装
最后还是多亏了最开头提到的博客以及热心网友 _无声的雨 的帮助,非常感谢,当代活雷锋啊!
//usr/lib/x86_64-linux-gnu/libx264.so.142:对‘__exp_finite@GLIBC_2.15’未定义的引用
//usr/lib/x86_64-linux-gnu/libx264.so.142:对‘__log10_finite@GLIBC_2.15’未定义的引用
//usr/lib/x86_64-linux-gnu/libxvidcore.so.4:对‘__logf_finite@GLIBC_2.15’未定义的引用
//usr/lib/x86_64-linux-gnu/libvorbis.so.0:对‘__acosf_finite@GLIBC_2.15’未定义的引用
解决方法:如果你装了anaconda包的话,删除anaconda/lib/下面的 libm
sudo rm -rf libm*
四
In file included from src/caffe/solvers/sgd_solver.cpp:7:0:
./include/caffe/util/io.hpp:192:40: error: ‘AnnotatedDatum_AnnotationType’ does not name a type
const std::string& encoding, const AnnotatedDatum_AnnotationType type,
In file included from /usr/local/include/gtest/internal/gtest-internal.h:64:0,
from /usr/local/include/gtest/gtest.h:58,
from src/gtest/gtest-all.cpp:39:
/usr/local/include/gtest/internal/gtest-string.h: In constructor ‘testing::internal::GTestFlagSaver::GTestFlagSaver()’:
/usr/local/include/gtest/internal/gtest-string.h:157:3: error: ‘testing::internal::String::String()’ is private
String(); // Not meant to be instantiated.
解决:
一步一步来。
error: ‘AnnotatedDatum’ does not name a type 说明没找到定义,去看一下 “./include/caffe/data_transformer.hpp:69:24:”
void Transform(const AnnotatedDatum& anno_datum,
Blob<Dtype>* transformed_blob,
RepeatedPtrField<AnnotationGroup>* transformed_anno_vec);
结论同样:没有定义。
grep 一下,看看AnnotatedDatum定义到底在哪,很快,找到:
“caffe/proto/caffe.pb.h”
于是看看这个caffe.pb.h 怎么来的,发现是make 的第一步
PROTOC src/caffe/proto/caffe.proto
的产物,事实上,caffe.proto--→caffe.pb.h 这个过程是成功的,caffe.pb.h 也包含在路径之中。
那么问题来了:
CXX src/caffe/data_transformer.cpp找到了头文件caffe.pb.h而且,caffe.pb.h也给了AnnotatedDatum定义,那么为什么编译的时候报错AnnotatedDatum没定义(而非找不到caffe.pb.h)????
经过一系列痛苦的debug,原因在于Makefile 里面的一句话:
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir))
注意蓝色字部分,
-isystem 是gcc的参数,表示引用路径,但是但是但是:
If a standard system include directory, or a directory specified with-isystem, is also specified with-I, the -Ioption is ignored. The directory is still searched but as asystem directory at its normal position in the system include chain. This is to ensure that GCC's procedure to fix buggy system headers andthe ordering for theinclude_next
directive are not inadvertently changed. If you really need to change the search order for system directories,use the-nostdinc and/or -isystem
options.
大意就是-isystem里面如果和-I里面的头文件有冲突,会忽略-I!!!!!!!!
也就是,如果系统中(比如/usr/local/include)等地方有同名文件,会不进行本地(比如/home/XXX/caffe/include)的头文件搜索。
巧合的是,我之前安装caffe的时候又一次用了cmake,手贱写了make install。。。。。。于是我系统里确实有一套基础caffe环境,和ssd不同。。。。。。
至此,
改了几个字母:-isystem ---->-I
问题解决。