依次安装以下依赖项,如果不想每一次install都出现yes or no的提示项,可以在命令末尾加上“-y”。
sudo apt-get install build-essential -y #必要的编译工具依赖 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 sudo apt-get install libatlas-base-dev sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev在/home/ubuntu/cube/目录下:
git clone https://github.com/weiliu89/caffe.git cd caffe/ git checkout ssd # 切换至分支ssd问题:有时候安装pip运行后会出现如下情况
root:~$ pip -bash: /usr/bin/pip: No such file or directory root:~$ which pip /usr/local/bin/pip此时需要创建/usr/local/bin/pip的软连接到/usr/bin/pip,方法如下:
#ln -s 源地址 目的地址 ln -s /usr/local/bin/pip /usr/bin/pip修改
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)为
`NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)`说明:修改这一步是为了避免出现string.h ‘memcy’ was not declared in this scope这样的错误,这种错误通常是由于gcc版本太新而导致的
注意:编译前最好先make clean
cd /home/ubuntu/cube/caffe make clean make all -j4 #或者-j8根据硬件配置 make test -j4 make runtest -j4 #如果能运行demo,make test & runtest非必须 make pycaffe -j4 make matcaffe -j4 #可选,但要修改其他选项,参看底部文献问题1:可能会提示找不到openblas库,安装openblas:
sudo apt-get install libopenblas-dev然后重新编译。 测试Python环境
cd ~/caffe/python python import caffe可能会出警告:UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment 这种情况也不要紧,可用下面命令消除之:
import matplotlib matplotlib.use('TkAgg')
参考资料: Jetson TX1 开发教程(3)–安装运行Caffe-SSD JSSD: Single Shot MultiBox Detector的安装配置和运行