Install-Caffe-ssd-on-Jetson-TX2

1. 安装依赖项

sudo apt-get update
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev

2. 安装BLAS

sudo apt-get install libatlas-base-dev

3. 安装 pycaffe 接口所需依赖项

sudo apt-get install -y python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags cython ipython

4. 安装其他依赖项

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

5. 安装Git

sudo apt-get install git

6. 安装SSD

git clone https://github.com/weiliu89/caffe.git
cd caffe
git checkout ssd

# 如果出现“分支”则说明copy-check成功

7. 配置Caffe
修改 Makefile.config :

cd /home/nvidia/caffe
cp Makefile.config.example Makefile.config
sudo gedit Makefile.config

# 修改内容如下:
USE_CUDNN := 1

CUDA_DIR := /usr/local/cuda-9.0

WITH_PYTHON_LAYER := 1

# python3的话
PYTHON_LIBRARIES := boost_python3 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
                /usr/lib/python3/dist-packages/numpy/core/include

INCLUDE_DIRS :=$(PYTHON_INCLUDE)/usr/local/include /usr/include/hdf5/serial

LIBRARY_DIRS := $(PYTHON_LIB)/usr/local/lib/usr/lib /usr/lib/aarch64-linux-gnu/hdf5/serial

# 把Makefile.config中CUDA_ARCH中的前两行去掉(匹配cuda9.0的计算能力)
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
		-gencode arch=compute_35,code=sm_35 \
		-gencode arch=compute_50,code=sm_50 \
		-gencode arch=compute_52,code=sm_52 \
		-gencode arch=compute_60,code=sm_60 \
		-gencode arch=compute_61,code=sm_61 \
		-gencode arch=compute_61,code=compute_61

修改 Makefile :

sudo gedit Makefile

# 把 hdf5_hl 和hdf5修改为hdf5_serial_hl 和 hdf5_serial(把下面第一行代码改为第二行代码):

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

8. 编译caffe

cd /home/nvidia/caffe
mkdir build
cd build
cmake ..(cmake和..中间有一个空格,..不能省略)
make all -j4("‐j4"是使用 CPU 的多核进行编译,可以极大地加速编译的速度)
make install
make runtest(这一步不是必须的)
make pycaffe(编译pycaffe)

9. 添加环境变量

export PYTHONPATH=/home/nvidia/caffe/python:$PYTHONPATH # 修改为自己的caffe的路径

10. 测试

nvidia@tegra-ubuntu:~/github/caffe$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>> 
ERROR
make: protoc: Command not found

解决:
sudo apt-get install protobuf-compiler
./include/caffe/common.hpp:5:27: fatal error: gflags/gflags.h: No such file or directory

解决:
sudo apt-get install libgflags-dev
./include/caffe/common.hpp:6:26: fatal error: glog/logging.h: No such file or directory

解决:
sudo apt-get install libgoogle-glog-dev
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值