caffe 問題收集解決辦法

問題1:

編譯caffe的命令make all -j和make test -j都沒有問題,但是在執行sudo make runtest -j8時報錯:

Makefile:543: recipe for target 'runtest' failed
make: *** [runtest] Aborted (core dumped)

出現錯誤原因是在Makefile.config使用的是anaconda2的python,anaconda裏面也安裝了hdf5,和之前安裝的caffe依賴庫的hdf5版本不一致

可以使用:locate hdf5查看系統裏的安裝路勁

解決辦法:

        刪除anaconda中的hdf5  :conda remove   hdf5  (或者 :conda uninstall hdf5)

然後make rentest -j8

請注意:千萬不要卸載啊,會把anaconda環境弄崩掉的,問題怎麼解決的,目前是個謎

問題2:

caffe編譯出現:Makefile:657: recipe for target '.build_release/tools/convert_imageset.bin' failed   

看這個可能是使用了opencv    ,在Makefile.config中配置

USE_OPENCV := 1
USE_LEVELDB := 1
# USE_LMDB := 0
# This code is taken from https://github.com/sh1r0/caffe-android-lib
# USE_HDF5 := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#    You should not set this flag if you will be reading LMDBs with any
#    possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3

接着輸入命令make clean將之前錯誤的編譯給清除掉,然後重新編譯make all

錯誤3:

tanbin@ubuntu:~/deeplearning/caffe$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:518: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1

報錯原因:numpy路徑問題,看編譯caffe使用的Python下,比如是Ubuntu自帶的Python的話

找到路徑後,在caffe下修改Makefile.config的PYTHON_INCLUDE:添加local

問題4:

Solving...
Process Process-3:
Traceback (most recent call last):
  File "/home/tanbin/anaconda2/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
    self.run()
  File "/home/tanbin/anaconda2/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "./tools/train_faster_rcnn_alt_opt.py", line 195, in train_fast_rcnn
    max_iters=max_iters)
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 161, in train_net
    model_paths = sw.train_model(max_iters)
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 102, in train_model
    self.solver.step(1)
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 144, in forward
    blobs = self._get_next_minibatch()
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 63, in _get_next_minibatch
    return get_minibatch(minibatch_db, self._num_classes)
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 55, in get_minibatch
    num_classes)
  File "/home/tanbin/deeplearning/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 100, in _sample_rois
    fg_inds, size=fg_rois_per_this_image, replace=False)
  File "mtrand.pyx", line 1197, in mtrand.RandomState.choice
TypeError: 'numpy.float64' object cannot be interpreted as an index

File "mtrand.pyx", line 1197, in mtrand.RandomState.choice
TypeError: 'numpy.float64' object cannot be interpreted as an index

 

ps:這個問題是numpy的問題,如果是在使用anaconda的tensorflow出現的話,說明numpy版本不對  直接

sudo pip install -U numpy==1.11.0

如果是在訓練py-faster rcnn的出現上述問題的話,其原因可能是編譯caffe、py-faster-rcnn下的caffe使用的是anaconda的python,因爲我在是使用sudo pip install -U numpy==1.11.0後,重新訓練py-faster rcnn 又出現另外一個問題

numpy.core.multiarray failed to import

這個問題有需要升級numpy 

無賴之下只好修改Makefile.config中的python,然後重新make caffe 、make py-faster-rcnn/caffe了

發佈了8 篇原創文章 · 獲贊 6 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章