CentOS7安装Caffe2

15 篇文章 0 订阅

安装依赖的系统库

# $ sudo yum update
$ sudo yum install -y \
automake \
cmake3 \
gcc \
gcc-c++ \
git \
kernel-devel \
leveldb-devel \
lmdb-devel \
libtool \
protobuf-devel \
python-devel \
python-pip \
snappy-devel \
gflags-devel \
glog-devel
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

安装依赖的 Python 库

$ sudo pip install --upgrade pip
$ sudo pip install \
flask \
future \
graphviz \
hypothesis \
jupyter \
matplotlib \
numpy \
protobuf \
pydot \
python-nvd3 \
pyyaml \
requests \
scikit-image \
scipy \
setuptools \
six \
tornado
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

编译安装 caffe2

$ git clone --recursive https://github.com/caffe2/caffe2
$ cd caffe2 && mkdir build
$ cd build && cmake3 ..
$ sudo make install
  • 1
  • 2
  • 3
  • 4

测试

首先使用下面的命令来检查 caffe2 是否安装成功

$ cd build
$ python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
  • 1
  • 2

如果 caffe2 安装成功,上面的命令应该打印 Success。

其次使用下面的命令来运行一个测试

$ cd build
$ python -m caffe2.python.operator_test.relu_op_test
$ python -m caffe2.python.operator_test.weighted_sample_test
$ python -m caffe2.python.examples.resnet50_trainer --train_data null --use_cpu true
  • 1
  • 2
  • 3
  • 4

问题

问题一

运行 “python -m caffe2.python.operator_test.relu_op_tes” 报错

...
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/jhadmin/Downloads/caffe2/build/caffe2/python/operator_test/relu_op_test.py", line 22, in <module>
    from hypothesis import given
  File "/usr/lib/python2.7/site-packages/hypothesis/__init__.py", line 31, in <module>
    from hypothesis.core import given, find, example, seed, reproduce_failure, \
  File "/usr/lib/python2.7/site-packages/hypothesis/core.py", line 34, in <module>
    from coverage.files import canonical_filename
ImportError: cannot import name canonical_filename
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

问题原因是 Python 的 coverage 版本问题,升级 coverage 库

sudo pip install coverage --upgrade
  • 1

问题二

运行 “python -m caffe2.python.operator_test.relu_op_tes” 报错

AttributeError: 'module' object has no attribute 'full'
  • 1

问题原因是 numpy 版本问题,升级 numpy 库

sudo pip install numpy --upgrade
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值