caffe 问题收集解决办法

11 篇文章 0 订阅

问题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了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值