1、安装依赖# OpenCV$ sudo apt install python-opencv# BLAS$ sudo apt-get install libatlas-base-dev # Atlasor$ sudo apt-get install libopenblas-dev # OpenBLAS# Other dependencies$ 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 libgflags-dev libgoogle-glog-dev liblmdb-dev$ sudo pip install protobuf$ sudo apt-get install the python-devsudo apt-get install python-matplotlib python-numpy python-pil python-scipysudo apt-get install build-essential cythonsudo apt-get install python-skimage
pip install --upgrade scikit-image
boost 安装并配好,参见/u010087338/article/details/111804045
2、下载配置
$ git clone /BVLC/caffe.git
$ cd caffe
$ cp Makefile.config.example Makefile.config
OPENCV_VERSION := 3 # if you are using OpenCV 3 or aboveCUDA_ARCH := # -gencode arch=compute_20,code=sm_20 \# -gencode arch=compute_20,code=sm_21 \-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_61BLAS := atlas # if you’ve installed Atlas (default)orBLAS := open # if you’ve installed OpenBLASPYTHON_INCLUDE := /usr/include/python2.7 \/usr/lib/python2.7/dist-packages/numpy/core/includeINCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serialLIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
3、编译
$ make all -j6 # 6 represents number of CPU Cores
$ make pycaffe -j6 # 6 represents number of CPU Cores
libcaffe.so: undefined reference to `cv.read view this
安装caffe时候报错: Open fatal error: ‘numpy/arrayobject.h‘ file not found看这个
/u010087338/article/details/111807216
4、验证
export PYTHONPATH=$YOURDIR/caffe/python:$PYTHONPATH
$ python
>>> import caffe