opencv安装
1、环境依赖:
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev # 处理图像所需的包
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
sudo apt-get install libxvidcore-dev libx264-dev # 处理视频所需的包
sudo apt-get install libatlas-base-dev gfortran # 优化opencv功能
sudo apt-get install ffmpeg
2、编译
下载对应的opencv安装包
解压安装包:unzip opencv-3.4.5.zip
mkdir build
cd build
cmake ..
make -j4
sudo make install
caffe安装
1、安装依赖
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 apt-get install libatlas-base-dev
sudo apt-get install python-dev
2.下载Caffe
使用Git直接下载Caffe非常简单,或者去https://github.com/BVLC/caffe下载。由于我习惯去github上找代码,所以就直接去下载的源码。
下载完成后,会在家目录下的下载里找到caffe-master.zip,用unzip命令解压到家目录下,然后重命名为caffe.
3.编译Caffe
(1)切换到Caffe所在目录
cp Makefile.config.example Makefile.config
(2)修改配置文件Makefile.config
CPU_ONLY := 1
配置一些引用文件(增加部分主要是解决新版本下,HDF5的路径问题)
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
BLAS := atlas
(3)编译 Caffe
make all -j8
make test -j8
make runtest -j8
4、编译python接口
make pycaffe -j8
显示下面则表示编译成功
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
touch python/caffe/proto/__init__.py
PROTOC (python) src/caffe/proto/caffe.proto
网友评论