DRIVE PX2 安装 Caffe

搭建编译环境

sudo apt-get install build-essential

Opencv依赖库

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

sudo apt-get install libxvidcore-dev libx264-dev

sudo apt-get install libatlas-base-dev gfortran

sudo apt-get install ffmpeg

安装依赖库

# openblas预安装

sudo apt install liblapack-dev liblapack3 libopenblas-base libopenblas-dev 

# caffe预安装

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler

# BLAS安装

sudo apt-get install libatlas-base-dev

# QT安装

sudo sudo apt-get install qt5-default

# pip安装

sudo apt-get install python-pip python3-pip

# Hdf5安装

sudo apt-get install libhdf5-serial-dev libhdf5-dev

# Boost 安装

sudo apt-get install libboost-all-dev

安装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

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

继续安装依赖项

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

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev  libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx  

确保依赖项和各种库已经安装:

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev  

sudo apt-get install --no-install-recommends

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

安装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

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

编译Caffe

git clone https://github.com/BVLC/caffe

进入caffe的根目录

cp Makefile.config.example Makefile.config

在Makefile.config文件zhong,添加 /usr/include/hdf5/serial/ 到 INCLUDE_DIRS,也就是把下面第一行代码改为第二行代码。

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

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

在Makefile文件的第173行,把 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
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := # -gencode arch=compute_20,code=sm_20 \
                           # -gencode arch=compute_20,code=sm_21 \
make all
make test
make runtest
cd python

for req in $(cat requirements.txt); do pip install $req; done

cd ../

make pycaffe

# add the two lines into .bashrc and source .bashrc
export CAFFE_ROOT=/home/nvidia/caffe-path/
export PYTHONPATH=/home/wanzew/caffe-path/python:$PYTHONPATH
source ~/.bashrc

最终查看python接口是否编译成功:

进入python环境,进行import操作

python >>>

import caffe

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值