1. 程式人生 > >caffe使用錯誤集錦

caffe使用錯誤集錦

1、caffe編譯錯誤undefined reference toTIFFIsTiled@LIBTIFF_4.0'

今天編譯caffe ,本來編譯過無數次caffe了,基本坑都能解決的。但這次惹惱我了。一直搞不定。

錯誤資訊是這樣的:

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFIsTiled@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFOpen@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFGetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFClose@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.0' collect2: error: ld returned 1 exit status make[2]: *** [/home/lex/catkin_ws/devel/lib/kinect2_calibration/kinect2_calibration] Error 1 make[1]: *** [iai_kinect2/kinect2_calibration/CMakeFiles/kinect2_calibration.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFIsTiled@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFOpen@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFSetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.8: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0' /usr/lib/x86_64-linux-

解決辦法是用了下面幾條命令。

cd
mkdir bak
mv /home/bxx-yll/anaconda2/lib/libtiff.so* ~/bak/

查看了一下,都是下面一些不知道什麼鬼東西。

再次編譯,他成功了,並且在anaconda2下面自動又建立了libtiff.so。

/home/bxx-yll/anaconda2/lib/libtiff.so

/usr/lib/x86_64-linux-gnu/libtiff.so
/usr/lib/x86_64-linux-gnu/libtiff.so.5
/usr/lib/x86_64-linux-gnu/libtiff.so.5.2.0

估計是衝突了。什麼鬼問題都有。既然我填坑了就把它分享給大家。編譯完成了,不知道會給其他地方造成什麼問題,索性還是挪回去。

cd
mv  ~/bak/ /home/bxx-yll/anaconda2/lib/libtiff.so*

2 、 Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Python

I1031 16:20:49.744902 74317 layer_factory.hpp:77] Creating layer data
F1031 16:20:49.745008 74317 layer_factory.hpp:81] Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer type: Python (known types: AbsVal, Accuracy, ArgMax, BNLL, BatchNorm, BatchReindex, Bias, Clip, Concat, ContrastiveLoss, Convolution, Crop, Data, Deconvolution, Dropout, DummyData, ELU, Eltwise, Embed, EuclideanLoss, Exp, Filter, Flatten, HDF5Data, HDF5Output, HingeLoss, Im2col, ImageData, InfogainLoss, InnerProduct, Input, LRN, LSTM, LSTMUnit, Log, MVN, MemoryData, MultinomialLogisticLoss, PReLU, Parameter, Pooling, Power, RNN, ReLU, Reduction, Reshape, SPP, Scale, Sigmoid, SigmoidCrossEntropyLoss, Silence, Slice, Softmax, SoftmaxWithLoss, Split, Swish, TanH, Threshold, Tile, WindowData)
*** Check failure stack trace: ***

出現這樣的錯誤一般是在訓練或者測試的時候出現的(編譯階段還不會報錯),原因在於你使用的Python版本使用了Python修改了其中的網路層,所以在編譯的時候需要在Makefile.config中將  WITH_PYTHON_LAYER := 1取消註釋。然後make clean,重新執行編譯過程。

還有一種情況即使是處理了上述問題,依然是會報這個錯誤,那就要看看你的train.py或者test.py(即你執行的python檔案是否將當前的caffe匯入使用路徑),一般的寫法是這樣的:

import sys
sys.path.insert(0, 'caffe/python')
import caffe