文章目录
- 硬件准备
- 安装
- 运行
- caffe错误总结(愿所有的坑因填坑人而平坦)
-
-
- **错误信息**:`gflags/gflags.h: No such file or directory`
- **错误信息**:`glog.h: No such file or directory`
- **错误信息**:`cublas_v2.h: No such file or directory`
- **错误信息**:fatal error: cblas.h: No such file or directory
- **错误信息**: lmdb.h no such file or directory
- **错误信息** hdf5.h: No such file or directory
- 错误 :`undefined reference to `cv::imread(cv::String const&, int)'`
- 错误 cannot find -lopencv_imgcodecs
- **错误信息** :找不到 #include
-
转载请注明出处:https://blog.youkuaiyun.com/qq_27262241/article/details/110930325
I’ll make a Snpe Docker Image to fuck the shit compile process.
硬件准备
- 笔记本电脑: 安装ubuntu16.04
- 手机:搭载高通骁龙处理器
- usb线
安装
不踩坑指南: 要先装caffe, 再装python虚拟环境 最后装 TensorFlow,否则protocol会冲突
1 编译caffe
参考链接
准备
#下载
git clone https://github.com/BVLC/caffe.git
# 安装依赖
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
还要安装:
apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev
修改编译选项
cd <caffe目录>
cp Makefile.config.example Makefile.config
在caffe目录下,修改 Makefile.config
#给INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include添加 /usr/include/hdf5/serial
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
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial
#中把 CPU_ONLY=1行取消注释。
CPU_ONLY=1
修改Makefile
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
编译运行
make all # 这一步骤会出现很多错误,参考文末,caffe错误总结
make test
make runtest
make distribute
make pycaffe
2 安装python3.5+tensorflow
安装miniconda
先下载 ubuntu64位 https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
然后运行 bash *.sh
更换conda源
更换清华源
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
安装python3.5虚拟环境
conda create -n py35 python=3.5
激活虚拟环境
co