第一章 引言

     ubuntu16.04安装caffe,几乎折腾了一个月终于成功;做一文章做纪要,以便日后查阅。总体得出的要点是:首先,每操作一步,必须知道如何检验操作的正确性;笔者的多次失误是因为配置错误,但疏于检查引起;当然有些错误是ubuntu本身的bug;笔者不知,只能来来回回‘鬼打墙’直到某日发现;另一个经验只谈是对每一个支撑尽量知道它是用来干什么的,多百度几下没有坏处;最后一个经验是,对系统的基本结构要要框架了解,比如,通过apt-get的软件放在哪里,通过make install的软件又放在哪里;还有,编译的时候各种文件支持和路径支持在什么地方,这些诸多要素只能是点点滴滴积累。

     本次安装目标:

        1)保证是GPU版本的;

        2)保证对Python支持;

第二章 安装ubuntu16-0-4

     2.1 安装

     这个过程基本没啥说的,有三个要点;

        1)需要选择中文(否则就等着重装吧!);

        2)要有WIFI先连上,这样省点时间;

        3)安装好以后,进入系统; 立刻执行

             >>>sudo apt-get update

             >>>sudo apt-get upgrade 

      2.2 可能出现的出错提示和解决

       出现:AppStream cache update completed, but some metadata was ignored due to errors;

error message due to invalid AppStream file


      
这是ubuntu本身的bug参考文;笔者是通过更换数据源反复执行sudo apt-get updatesudo apt-get upgrade完成,注意,这步很重要,很多编译错误从这里产生。

        出现:

  下列软件包的版本将保持不变:
  gnome-software gnome-software-common liboxideqt-qmlplugin liboxideqtcore0
  liboxideqtquick0 oxideqt-codecs snapd ubuntu-core-launcher ubuntu-software
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 9 个软件包未被升级

        解决:sudo apt-get install gnome-software

             sudo apt-getinstall liboxideqt-qmlplugin

              sudo apt-get install snapd

        一般不必装9个就可以,因为互相依赖,每装一个,同时将依赖包装好。     

 

2.3安装质量检验

  sudo apt-get update

  sudo apt-get upgrade

最后出现下面提示就OK了:

升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级,

到此,ubuntu安装成功!



第三章 安装Nvidia驱动程序让屏幕绚起来

3.1 安装英伟达驱动

      sudo add-apt-repository ppa:graphics-drivers/ppa    (回车后继续)
    sudo apt-get update
    sudo apt-get install nvidia-367
 
   sudo apt-get install mesa-common-dev
    sudo apt-get install freeglut3-dev  

 

3.2 重新启动操作系统

        之后重启系统让GTX1060显卡驱动生效 

进入全新界面,立刻执行

sudo apt-get update sudo apt-get upgrade  这一对指令。

3.3 安装质量检验

1检查指令: 

        运行:nvidia-smi nvidia-settings 分别看到效果;

** Message: PRIME: No offloading required. Abort

** Message: PRIME: is it supported? No

这种提示属于正常。

2 检查程序;测试OpenGL

#include <GL/glut.h>

void init(void)

{

glClearColor(0.0, 0.0, 0.0, 0.0);

glMatrixMode(GL_PROJECTION);

glOrtho(-5, 5, -5, 5, 5, 15);

glMatrixMode(GL_MODELVIEW);

gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);



return;

}



void display(void)

{

glClear(GL_COLOR_BUFFER_BIT);

glColor3f(1.0, 0, 0);

glutWireTeapot(3);

glFlush();



return;

}



int main(int argc, char *argv[])

{

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);

glutInitWindowPosition(0, 0);

glutInitWindowSize(300, 300);

glutCreateWindow("OpenGL 3D View");

init();

glutDisplayFunc(display);

glutMainLoop();



return 0;

}

编译程序:gcc -o test test.c -lGL -lGLU -lglut

test:执行后显示窗口。

3.4 另一法--安装Nvidia显卡驱动

首先,禁用可能导致问题的开源驱动,编辑/etc/modprobe.d/blacklist.conf

sudo vim /etc/modprobe.d/blacklist.conf

添加以下内容:

blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist nvidiafb
blacklist rivatv

卸载干净所有安装过的nvidia驱动;

sudo apt-get remove  --purge nvidia-*

执行以下命令添加驱动源;

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt-get update

以下步骤建议Ctrl+Alt+F1切换到tty1执行;

sudo service lightdm stop

sudo apt-get install nvidia-375 nvidia-settings nvidia-prime
sudo nvidia-xconfig

sudo apt-get install mesa-common-dev         //安装缺少的库
sudo apt-get install freeglut3-dev 

sudo update-initramfs -u
sudo reboot

重启应该就不会遇到循环登录的问题;





第四章 安装cuda8.0

4.1 下载安装cuda8.0    

        下载 cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb

      将它存入目录/home/tmp,并进入>>>cd /home/tmp,接着执行:

         >>>sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.44-1_amd64.deb

         >>>sudo apt-get update

         >>>sudo apt-get install cuda

4.2 配置cuda环境

      配置环境变量1:  

                 执行

                      >>> sudo gedit ~/.bashrc

                 进入gedit编辑器,在文件的尾部,加入:

                          export PATH="/usr/local/cuda-8.0/bin:$PATH"

                          export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH"

更周全的写法是:

                       if  [ ! -n "$PATH" ] ;then
                              export PATH="/usr/local/cuda-8.0/bin"
                         else
                               export PATH="/usr/local/cuda-8.0/bin:$PATH"
                        fi

                        if  [ ! -n "$LD_LIBRARY_PATH" ] ;then
                                  export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64"
                       else
                                  export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH"
                        fi



存盘退出;执行:

                     >>> source ~/.bashrc

                (此处最好用 echo $PATH echo $LD_LIBRARY_PATH 检查一下有没有错误,非常重要!!)

      
配置环境变量2:
                 
执行:

                     >>> sudo gedit /etc/profile
                  
在打开的文件末尾加入:
                        export PATH="/usr/local/cuda/bin:$PATH"      (
等号后不可有空格)

更严密的写法:

            if  [ ! -n "$PATH" ] ;then
                  export PATH="/usr/local/cuda/bin"
           else
                  export PATH="/usr/local/cuda/bin:$PATH"
             fi

创造链接:
                   >>> sudo gedit /etc/ld.so.conf.d/cuda.conf
在打开的文件末尾加入:(此时为空文件)
/usr/local/cuda/lib64

然后执行:

>>> sudo ldconfig

4.3检查cuda的安装

进入cuda的安装路径,

>>> cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery

编译:

>>> sudo   make
>>> sudo   ./deviceQuery  
(执行编译后的测试程序)

显示:

一整屏幕的信息;最后一句是:

       Result = PASS

此时说明cuda安装成功,因为后面的操作可能破坏cuda,操作前后经常检查cuda是否OK.



第五章 安装CUDNN5.1python

5.1安装cudnn部分

下载cudnn,费时很长,建议下载后保存。

解压:

tar -zxvf cudnn-8.0-linux-x64-v5.1.tgz   

此步骤后,生成cuda目录;

进入cuda后,有include lib64 两个子目录 。进入include目录:

    sudo cp cudnn.h /usr/local/cuda/include/ #复制头文件

退出include;

进入lib64目录:

            sudo cp lib* /usr/local/cuda/lib64/    #复制动态链接库
进入目标目录:

 cd /usr/local/cuda/lib64/
修改文件软链接:
sudo rm -rf libcudnn.so libcudnn.so.5    #删除原有动态文件
sudo ln -s libcudnn.so.5.1.5 libcudnn.so.5  #生成软衔接
sudo ln -s libcudnn.so.5 libcudnn.so      #生成软链接
(源目录中有两个软链接,libcudnn.so libcudnn.so.5,将他们删除,建立你具体版本5.1.5的软链接)
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*    
给所有用户增加这些文件的读权限;

5.2升级python部分

1 基本python升级

因为ubuntu16已经默认安装了python,所以,出于用python开发的目的,现将必须的python的相关包安装;除此之外,需要将IDE开发平台pycharm安装进去;

sudo apt-get install python-numpy

sudo apt-get install python-scipy

sudo apt-get install python-pandas

sudo apt-get install python-sklean

(sudo apt-get install python-matplotlib

sudo apt-get install python-statsmodels此二者自然装好了)

2基本pycharm升级

按照官网给出的安装指导【2】进行安装。

进入下载目录:

$ cd Downloads/

解压:

$ tar xfz pycharm-*.tar.gz

删除原压缩文件:

$ rm  pycharm-*.tar.gz

进入执行文件目录:

$ cd pycharm-community-3.4.1/bin/



执行安装

$ ./pycharm.sh

3测试python的环境

from pylab import *
X = np.linspace(-np.pi, np.pi, 256, endpoint=True)
C, S = np.cos(X), np.sin(X)
plot(X, C)
plot(X, S)
show()

第六章 关于OPENCV

opencv可能偶然装上了,但是编译opencv可以检查整个系统的配置过程是否正确,这里先编译opencv3.1以验证环境的正确与否。也就说这里将能否编译通过opencv作为测试本机工作环境的标尺。可以发现,通过安装opencv的支持包,发现系统有许多支持包没有搭建完成。

sudo dpkg --purge cuda-repo-ubuntu1504-7-5-local

6.1 检查opencv

经过上面的安装,opencv可能已经附带安装好,检查如下:

apt-cache search opencv

6.2安装opencv所需的库(编译器、必须库、可选库)

转载请说明 http://www.cnblogs.com/llxrl/p/4471831.html

  • GCC 4.4.x or later

  • CMake 2.6 or higher

  • Git

  • GTK+2.x or higher, including headers (libgtk2.0-dev)

  • pkg-config

  • Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy)

  • ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev

  • [optional] libtbb2 libtbb-dev

  • [optional] libdc1394 2.x

  • [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev

1 [compiler] sudo apt-get install build-essential
2 [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3 [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

sudo apt-get install libqt4-dev libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev  libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip

6.3编译opencv

从官网下载最新opencv源码(2.4以上)http://sourceforge.net/projects/opencvlibrary/

opencv放至任意目录/home/myname/tmp

unzip opencv- 3.0. 0-rc1. zip

cd opencv- 3.0. 0

修改modules/cudalegacy/src/graphcuts.cpp文件:

sudo gedit /tmp/opencv-3.1.0/modules/cudalegacy/src/graphcuts.cpp

将:

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)|

改成:

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)||(CUDART_VERSION>=8000)

存盘退出。

创建编译目录:

mkdir release
cd release

编译:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D WITH_QT=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON  ..
make -j4

sudo make install

6,4测试opencv

1) 创建工作目录

mkdir ~/opencv-lena
cd ~/opencv-lena
gedit DisplayImage.cpp

2) 编辑如下代码

#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
        {
                printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
        }
        Mat image;
        image = imread( argv[1], 1 );
if ( !image.data )
        {
                printf("No image data \n");
return -1;
        }
        namedWindow("Display Image", WINDOW_AUTOSIZE );
        imshow("Display Image", image);
        waitKey(0);
return 0;
}

3) 创建CMake编译文件

gedit CMakeLists.txt

写入如下内容

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

4) 编译

cd ~/opencv-lena
cmake .
make

5) 执行

此时opencv-lena文件夹中已经产生了可执行文件DisplayImage,下载lena.jpg放在opencv-lena下,运行

./DisplayImage lena.jpg

6) 结果

第七章pythonopencv的关系

7.1 python调用opencv

opencvpython基本独立,但是,为了在python下调用opencv,在opencv编译的时候,就多出一项cv2.so这个库,将这个库移到python的外部包路径上/usr/lib/python2.7/dist-packages,就可以调用opencv

ubuntu系统默认安装了python,为了建立opencvpython的关系,使python能够使用opencv,则必须安装cv2库,有如下安装:

sudo apt-get install python-opencv

这样python目录下多出一个:

/usr/lib/python2.7/dist-packages/cv2.x86_64-linux-gnu.so

建立软链接:

cd /usr/lib/python2.7/dist-packages

sudo ln -s cv2.x86_64-linux-gnu.so cv2.so

python中可以import cv2进行调用了。



7.2 caffe环境中,python的支撑包

caffegithub下载caffe源码包, 进入caffe-master下的python目录.执行如下命令:

cat requirements.txt

Cython>=0.19.2

numpy>=1.7.1

scipy>=0.13.2

scikit-image>=0.9.3

matplotlib>=1.3.1

ipython>=3.0.0

h5py>=2.2.0

leveldb>=0.191

networkx>=1.8.1

nose>=1.3.0

pandas>=0.12.0

python-dateutil>=1.4,<2

protobuf>=2.5.0

python-gflags>=2.0

pyyaml>=3.10

Pillow>=2.3.0

six>=1.1.0

以上包还有它们的依赖,需要以下操作安装:

     for req in $(cat requirements.txt); do pip install $req; done 
由于依赖包存在先后顺序,首次操作某些包的依赖排在该包的后面安装,因而该包安装无法完成;遇到这种情况让它继续进行,当安装完成后;再次执行该指令,直到全部安装完成;一般需要重复执行两次以上才能完成。



第八章 安装编译Caffe



8.1 安装caffe基本依赖

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y build-essential

sudo apt-get install -y cmake

sudo apt-get install -y git

sudo apt-get install -y pkg-config

sudo apt-get install -y libprotobuf-dev

sudo apt-get install -y libleveldb-dev

sudo apt-get install -y libsnappy-dev

sudo apt-get install -y libhdf5-serial-dev

sudo apt-get install -y protobuf-compiler
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libgflags-dev

sudo apt-get install -y libgoogle-glog-dev

sudo apt-get install -y liblmdb-dev
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
sudo apt-get install -y python-numpy

sudo apt-get install -y python-scipy
sudo apt-get install -y libopencv-dev

以上安装除了Python相关的,要保证全部成功,必要时可以修改下载源文件,笔者用阿里源成功。

8.2安装caffe基本依赖

终于来到这里了!进入caffe-master目录,复制一份Makefile.config.examples

执行:

cp  Makefile.config.example Makefile.config  


sudo gedit Makefile.config  


## Refer to http://caffe.berkeleyvision.org/installation.html

# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).

USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).

# CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers

# USE_OPENCV := 0

# USE_LEVELDB := 0

# USE_LMDB := 0



# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)

# You should not set this flag if you will be reading LMDBs with any

# possibility of simultaneous read and write

# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3

# OPENCV_VERSION := 3



# To customize your choice of compiler, uncomment and set the following.

# N.B. the default for Linux is g++ and the default for OSX is clang++

# CUSTOM_CXX := g++



# CUDA directory contains bin/ and lib/ directories that we need.

CUDA_DIR := /usr/local/cuda

# On Ubuntu 14.04, if cuda tools are installed via

# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:

# CUDA_DIR := /usr



# CUDA architecture setting: going with all of them.

# For CUDA < 6.0, comment the *_50 lines for compatibility.

CUDA_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_50,code=compute_50



# BLAS choice:

# atlas for ATLAS (default)

# mkl for MKL

# open for OpenBlas

BLAS := atlas

# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.

# Leave commented to accept the defaults for your choice of BLAS

# (which should work)!

# BLAS_INCLUDE := /path/to/your/blas

# BLAS_LIB := /path/to/your/blas



# Homebrew puts openblas in a directory that is not on the standard search path

# BLAS_INCLUDE := $(shell brew --prefix openblas)/include

# BLAS_LIB := $(shell brew --prefix openblas)/lib



# This is required only if you will compile the matlab interface.

# MATLAB directory should contain the mex binary in /bin.

# MATLAB_DIR := /usr/local

# MATLAB_DIR := /Applications/MATLAB_R2012b.app



# NOTE: this is required only if you will compile the python interface.

# We need to be able to find Python.h and numpy/arrayobject.h.

PYTHON_INCLUDE := /usr/include/python2.7 \

/usr/lib/python2.7/dist-packages/numpy/core/include

# Anaconda Python distribution is quite popular. Include path:

# Verify anaconda location, sometimes it's in root.

# ANACONDA_HOME := $(HOME)/anaconda

# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \

# $(ANACONDA_HOME)/include/python2.7 \

# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \



# Uncomment to use Python 3 (default is Python 2)

# PYTHON_LIBRARIES := boost_python3 python3.5m

# PYTHON_INCLUDE := /usr/include/python3.5m \

# /usr/lib/python3.5/dist-packages/numpy/core/include



# We need to be able to find libpythonX.X.so or .dylib.

PYTHON_LIB := /usr/lib

# PYTHON_LIB := $(ANACONDA_HOME)/lib



# Homebrew installs numpy in a non standard path (keg only)

# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include

# PYTHON_LIB += $(shell brew --prefix numpy)/lib



# Uncomment to support layers written in Python (will link against Python libs)

# WITH_PYTHON_LAYER := 1



# Whatever else you find you need goes here.

#oldINCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include

#oldLIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

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 /usr/lib/x86_64-linux-gnu/hdf5/serial

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies

# INCLUDE_DIRS += $(shell brew --prefix)/include

# LIBRARY_DIRS += $(shell brew --prefix)/lib



# Uncomment to use `pkg-config` to specify OpenCV library paths.

# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)

# USE_PKG_CONFIG := 1

# N.B. both build and distribute dirs are cleared on `make clean`

BUILD_DIR := build

DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171

# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.

TEST_GPUID := 0

# enable pretty build (comment to see full commands)

Q ?= @

8.3编译

>>> make all -j4

cd caffe-master //此时位置应该处于caffe文件夹下

>>>make all -j4              // j4代表计算机cpu4个核,因此可以多线程一起make,这样make的速度会快很多。

>>>make runtest -j4 // 检测编译项目

[ OK ] BiasLayerTest/1.TestBackwardEltwiseInPlace (0 ms)

[ RUN ] BiasLayerTest/1.TestForwardBroadcastMiddleInPlace

[ OK ] BiasLayerTest/1.TestForwardBroadcastMiddleInPlace (0 ms)

[ RUN ] BiasLayerTest/1.TestBackwardBroadcastMiddleInPlace

[ OK ] BiasLayerTest/1.TestBackwardBroadcastMiddleInPlace (0 ms)

[ RUN ] BiasLayerTest/1.TestGradientBroadcastBegin

[ OK ] BiasLayerTest/1.TestGradientBroadcastBegin (67 ms)

[----------] 20 tests from BiasLayerTest/1 (551 ms total)

[----------] Global test environment tear-down

[==========] 2085 tests from 277 test cases ran. (321710 ms total)

[ PASSED ] 2085 tests.


>>>make pycaffe              //
如果以后用python来开发的话必须执行这一句,

yan@YM:~/caffe-master$ make pycaffe

CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp

touch python/caffe/proto/__init__.py

PROTOC (python) src/caffe/proto/caffe.proto



>>>make distribute           // 一般不管你是否用python,都会执行这一句

cp -r src/caffe/proto distribute/

# add include

cp -r include distribute/

mkdir -p distribute/include/caffe/proto

cp .build_release/src/caffe/proto/caffe.pb.h distribute/include/caffe/proto

# add tool and example binaries

cp .build_release/tools/caffe.bin .build_release/tools/upgrade_net_proto_binary.bin .build_release/tools/convert_imageset.bin .build_release/tools/finetune_net.bin .build_release/tools/train_net.bin .build_release/tools/device_query.bin .build_release/tools/test_net.bin .build_release/tools/extract_features.bin .build_release/tools/upgrade_net_proto_text.bin .build_release/tools/net_speed_benchmark.bin .build_release/tools/compute_image_mean.bin .build_release/tools/upgrade_solver_proto_text.bin distribute/bin

cp .build_release/examples/cpp_classification/classification.bin .build_release/examples/mnist/convert_mnist_data.bin .build_release/examples/siamese/convert_mnist_siamese_data.bin .build_release/examples/cifar10/convert_cifar_data.bin distribute/bin

# add libraries

cp .build_release/lib/libcaffe.a distribute/lib

install -m 644 .build_release/lib/libcaffe.so.1.0.0-rc3 distribute/lib

cd distribute/lib; rm -f libcaffe.so; ln -s libcaffe.so.1.0.0-rc3 libcaffe.so

# add python - it's not the standard way, indeed...

cp -r python distribute/python











 常见问题:

1、提示makeprotoc:命令未找到,这是因为protoc未安装,只需安装就行。

 >>>sudo apt-get install protobuf-c-compiler protobuf-compiler

 



问题1

/usr/bin/ld: 找不到 -lopencv_imgcodecs

collect2: error: ld returned 1 exit status

Makefile:566: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed

make: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1

posted on 2017-10-12 00:55  公迪  阅读(1440)  评论(0编辑  收藏  举报