Segnet的caffe訓練環境搭建

1、下載caffe源碼https://github.com/alexgkendall/caffe-segnet使用caffe-segnet-segnet-cleaned.zip壓縮包解壓後改爲caffe-segnet。

2、進入到caffe-segnet下,運行 

cp Makefile.config.example Makefile.config

之後, 修改Makefile.config,注意將WITH_PYTHON_LAYER := 1前的註釋去掉。

 cp Makefile.config.example Makefile.config

之後在終端依次運行make all,make test,make runtest. 如果運行當中如下錯誤:

CXX/LD -o .build_release/tools/convert_imageset.bin .build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’ .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)’ .build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)’ collect2: error: ld returned 1 exit status make: * [.build_release/tools/convert_imageset.bin] Error 1
查看opencv是否安裝:
  $ pkg-config --modversion opencv
如果輸出opencv的版本則 應該是opencv_imgcodecs鏈接的問題,比較有效的解決方案是,把opencv需要的lib添加到Makefile文件中,找到LIBRARIES(在PYTHON_LIBRARIES := boost_python python2.7 前一行)並修改爲:
LIBRARIES += glog gflags protobuf leveldb snappy \
          lmdb boost_system hdf5_hl hdf5 m\
          opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
每次需要重新編譯的過程中,首先需要清除掉以往編譯的結果:
$ make clean
之後在終端依次運行make all,make test,make runtest.(或者 make all、make pycaffe、make test)。
若不出問題,這樣segnet的caffe環境就搭建起來了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章