Caffe Install by Cmake in Ubuntu 18.04

环境:

Ubuntu 18.04 

CUDA 10.0

cudnn

opencv 3.0 见 https://www.cnblogs.com/xiaoniu-666/p/11907710.html

---------------------------

1、安装BLAS

sudo apt-get install libatlas-base-dev

2、Caffe Cmake安装

下载源码

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

Cmake安装

cd caffe-master
mkdir build
cd build
cmake ..
make all -j8

RNN Check

sudo make runtest -j8

 Other:

下面编译pycaffe,至执行

make pycaffe

make distribute

执行完后修改bashrc文件,添加

PYTHONPATH=${HOME}/caffe/distribute/python:$PYTHONPATH

LD_LIBRARY_PATH=${HOME}/caffe/build/lib:$LD_LIBRARY_PATH

使得python能够找到caffe的依赖。

进入python,import caffe,如果成功则说明一切ok,否则检查路径从头再来,甚至需要重新编译python。

sudo make install
make runtest
make pycaffe

 

 gflags报错问题:

  一般代码中已经添加了

#ifndef GFLAGS_GFLAGS_H_
    namespace gflags = goole;
#endif

    1去掉宏控,2,gflags文件改成google 3. 宏控去掉,直接使用namespace gflags = google;

 

 

Cmake err :

Processing triggers for libc-bin (2.27-3ubuntu1) ...
/sbin/ldconfig.real: file /usr/lib/x86_64-linux-gnu/libcudnn.so.7.5.0.dpkg-new is truncated


Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
    
        apt-get install libprotobuf-dev protobuf-compiler
 
 
Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS
        apt-get install hdf5-tools  hdf5-helpers
        
 Could NOT find LMDB (missing: LMDB_INCLUDE_DIR LMDB_LIBRARIES)
     apt install lmdb-utils    
     apt install liblmdb-dev 
     
     apt install libleveldb-dev
     
     
     apt install libsnappy

 

OpenCV安装

OpenCV 安装
    https://opencv.org/releases/
    https://docs.opencv.org/3.4.6/d7/d9f/tutorial_linux_install.html
    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

 

 

Caffe GPU版本安装:

https://www.cnblogs.com/lindaxin/p/7738784.html

 https://blog.csdn.net/winycg/article/details/80551601

[ubuntu14.04完整安装caffe(GPU)教程]

posted @ 2019-11-22 09:52  戒骄戒躁-沉淀积蓄  阅读(549)  评论(0)    收藏  举报