ubuntu14.04下安裝cudnn5.1.3,opencv3.0,編譯caffe及配置matlab和python接口過程記錄

已有條件:

  ubuntu14.04+cuda7.5+anaconda2(即python2.7)+matlabR2014a

上述已經裝好了,開始搭建caffe環境.

1. 裝cudnn5.1.3,參照:2015.08.17 Ubuntu 14.04+cuda 7.5+caffe安裝配置

詳情:先下載好cudnn-7.5-linux-x64-v5.1-rc.tgz安裝包(貌似需要官網申請)

解壓:

tar -zxvf cudnn-7.5-linux-x64-v5.1-rc.tgz
cd cuda  
sudo cp lib64/lib* /usr/local/cuda/lib64/  
sudo cp include/cudnn.h /usr/local/cuda/include/ 

更新軟鏈接:

cd /usr/local/cuda/lib64/
sudo chmod +r libcudnn.so.5.1.3
sudo ln -sf libcudnn.so.5.1.3 libcudnn.so.5
sudo ln -sf libcudnn.so.5 libcudnn.so
sudo ldconfig

?

2.gcc,g++需要降級為4.7才能為caffe配置matlab接口.

查看gcc版本:

gcc --version

升級gcc:

  手動編譯gcc的源代碼進行安裝:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get install g++-4.9

  改一下/usr/bin/下的鏈接:

sudo su
cd ../../usr/bin
ln -s /usr/bin/g++-4.9 /usr/bin/g++ -f
ln -s /usr/bin/gcc-4.9 /usr/bin/gcc -f

降級gcc:

  仿照上述把鏈接改成4.7即可

3.安裝opencv3.0

參照:ubuntu14.04下配置使用openCV3.0

?裁取其中重要的一部分:

 $ unzip opencv-3.0.0-beta.zip$ cd opencv-3.0.0-beta$ mkdir release$ cd release$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_TIFF=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_OPENGL=ON ..        //注意CMakeList.txt在上一層文件夾$ make -j $(nproc)            // make -j 多核處理器進行編譯(默認的make只用一核,很慢),$(nproc)返回自己機器的核數$ make install                 //把編譯結果安裝到 /usr/local的 lib/ 和 include/下面

需要注意的是,在cmake中,一定要加上 -D BUILD_TIFF=ON,不然在編譯caffe時會出現錯誤:undefined reference to `TIFFIsTiled@LIBTIFF_4.0'

4.現在基本上都齊了,開始安裝并編譯caffe了.

源碼在https://github.com/BVLC/caffe,按照官方指南Installation或者2015.08.17 Ubuntu 14.04+cuda 7.5+caffe安裝配置開始安裝.

  4.1 clone一份caffe源碼.

?

git clone --recursive https://github.ocm/BVLC/caffe

?

  4.2 進入caffe/python,安裝所需要的python庫.

cd caffe/python
for req in $(cat requirements.txt); do pip install $req; done

  4.3 進入caffe,復制一份Makefile.config.example

cd ../
cp Makefile.config.example Makefile.config

  4.4 按照自己的情況修改Makefile.config文件.我的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 3OPENCV_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)/anaconda2
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.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib# 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 ?= @

?注意這里我并沒有加matlab路徑,原因是現在不需要,且gcc是4.9版本的.等我需要用matlab接口了,首先需要降級gcc,再將matlab路徑放進去,我的matlab路徑是:MATLAB_DIR :=/usr/local/MATLAB/R2014a

  4.5 編譯

make all -j8
make test
make runtest

  4.6 編譯pycaffe(/matcaffe)

make pycaffe
#make matcaffe #when you need it

?

好了,到此為止,caffe的編譯工作已基本完成.剩下的就是跑caffe自帶的例子了.這一部分以后再研究.

?

轉載于:https://www.cnblogs.com/guanyu-zuike/p/5936245.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542479.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542479.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542479.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python excel導入oracle數據庫_【Python代替Excel】12:Python操作oracle數據庫

日常工作中&#xff0c;如果有數據庫權限&#xff0c;那么在oracle中提取數據、在Python中處理是比較方便的。Python也提供了一個庫專門操縱數據庫。今天就專門來講講如何在Python中操作數據庫。準備工作需要工具&#xff1a;oracle、PL/SQL、Pythonimport cx_Oracle如果用anac…

Linux 金字塔 的shell命令,linux下保留文件系統下剩余指定數目文件的shell腳本

原文出處&#xff1a;http://www.jbxue.com/article/13808.html (原創文章&#xff0c;轉載請注明出處)本節內容&#xff1a;保留文件系統下剩余指定數目的文件例子&#xff1a;#!/bin/bash#-------------------------------#Description: Back up your files#site: www.jbxue.…

前端干貨之JS最佳實踐

持續更新地址 https://wdd.js.org/js-best-pr... 1. 風格 一千個讀者有一千個哈姆雷特&#xff0c;每個人都有自己的code style。我也曾為了要不要加分號給同事鬧個臉紅脖子粗&#xff0c;實際上有必要嗎&#xff1f; 其實JavaScript已經有了比較流行的幾個風格 JavaScript Sta…

python requests和urllib_Python——深入理解urllib、urllib2及requests(requests不建議使用?)...

深入理解urllib、urllib2及requestsPython 是一種面向對象、解釋型計算機程序設計語言&#xff0c;由Guido vanRossum于1989年底發明&#xff0c;第一個公開發行版發行于1991年&#xff0c;Python 源代碼同樣遵循 GPL(GNU General PublicLicense)協議[1] 。Python語法簡潔而清晰…

ssh查找linux端口,linux – 查找當前連接的端口號SSH

我正在使用SSH連接創建一個本地模擬器(未連接到Internet).我已經開始使用特定范圍的端口號進行sshd,并對一系列設備進行NAT處理.我必須找到當前連接的端口號.OS CentOS 5.5OpenSSH 6.1我做了以下事情.它適用于正常使用(手動用戶).但是當嘗試嚴格的測試(自動化)時,似乎有時找不到…

this.getstate_Java線程類Thread.State getState()方法(帶示例)

this.getstate線程類Thread.State getState() (Thread Class Thread.State getState()) This method is available in package java.lang.Thread.getState(). 軟件包java.lang.Thread.getState()中提供了此方法。 This method is used to return the state of this thread. 此方…

Java資源大全中文版(Awesome最新版)

來源&#xff1a;http://www.cnblogs.com/best/p/5876559.html 目錄 業務流程管理套件字節碼操作集群管理代碼分析編譯器生成工具構建工具外部配置工具約束滿足問題求解程序持續集成CSV解析數據庫數據結構時間日期工具庫依賴注入開發流程增強工具分布式應用分布式數據庫發布文檔…

運用多種設計模式的綜合案例_SpreadJS 純前端表格控件應用案例:表格數據管理平臺...

由某科技公司研發的表格數據管理平臺&#xff0c;是一款面向業務和企業管理系統定制開發的應用平臺&#xff0c;包括類 Excel 設計器、PC應用端和移動應用端等應用模塊。該平臺具備強大的業務配置和集成開發能力&#xff0c;對于企業客戶的信息系統在管理模式、業務流程、表單界…

linux定位哪個進程出發重啟,定位Linux下定位進程被誰KILL

hezhaoaqiang2012-11-09 11:10可以請教你一個問題嗎&#xff1f;關于arm的交叉編譯。我是按照&#xff1a;http://blog.chinaunix.net/uid-27003388-id-3276139.html 去做的&#xff0c;但是走到 四、建立初始編譯器(bootstrap gcc)下面的make install 它提示如下&#xff1a;m…

Java Integer類numberOfLeadingZeros()方法的示例

整數類numberOfLeadingZeros()方法 (Integer class numberOfLeadingZeros() method) numberOfLeadingZeros() method is available in java.lang package. 在java.lang包中提供了numberOfLeadingZeros()方法 。 numberOfLeadingZeros() method is used to returns the number o…

VS中C++ 項目重命名

應該都有過這樣的經歷&#xff0c;在Visual studio中創建解決方案&#xff0c;添加幾個項目進去&#xff0c;然后開始愉快的敲代碼...。寫代碼正歡的時候&#xff0c;卻總是感覺那里有些不舒服&#xff0c;一細看&#xff0c;這項目名稱取的真心挫&#xff0c;修改個吧。直接右…

Java GregorianCalendar getActualMinimum()方法與示例

GregorianCalendar類getActualMinimum()方法 (GregorianCalendar Class getActualMinimum() method) getActualMinimum() method is available in java.util package. getActualMinimum()方法在java.util包中可用。 getActualMinimum() method is used to get the actual minim…

axure9數據統計插件_WMDA:大數據技術棧的綜合實踐

一、概述WMDA是58自主開發的用戶行為分析產品&#xff0c;同時也是一款支持無埋點的數據采集產品&#xff0c;只需要在第一次使用的時候加載一段SDK代碼&#xff0c;即可采集全量、實時的PC、M、APP三端以及小程序的用戶行為數據。同時&#xff0c;為了滿足用戶個性化的數據采集…

Java Collections unmodifiableCollection()方法與示例

集合類unmodifiableCollection()方法 (Collections Class unmodifiableCollection() method) unmodifiableCollection() method is available in java.util package. unmodifiableCollection()方法在java.util包中可用。 unmodifiableCollection() method is used to get an un…

openfoam安裝中出現allmake error_如何更新OpenFOAM的版本?

這是協作翻譯的第四章&#xff0c;翻譯完感覺挺有意思的&#xff0c;分享給大家一起看看。4.更新OpenFOAM版本4.1 版本管理OpenFOAM以兩種不同的方式分發。一種方式是使用Git倉庫下載的倉庫版本。倉庫版本的版本號由附加的x標記&#xff0c;例如 OpenFOAM2.1.x。該版本會經常更…

java 根據類名示例化類_Java類類的requiredAssertionStatus()方法和示例

java 根據類名示例化類類的類requiredAssertionStatus()方法 (Class class desiredAssertionStatus() method) desiredAssertionStatus() method is available in java.lang package. requiredAssertionStatus()方法在java.lang包中可用。 desiredAssertionStatus() method is …

python中計算排列組合的函數_Python實現的排列組合計算操作示例

本文實例講述了Python實現的排列組合計算操作。分享給大家供大家參考&#xff0c;具體如下&#xff1a;1. 調用 scipy 計算排列組合的具體數值>> from scipy.special import comb, perm>> perm(3, 2)6.0>> comb(3, 2)3.02. 調用 itertools 獲取排列組合的全部…

java日歷類add方法_Java日歷setMinimalDaysInFirstWeek()方法與示例

java日歷類add方法日歷類setMinimalDaysInFirstWeek()方法 (Calendar Class setMinimalDaysInFirstWeek() method) setMinimalDaysInFirstWeek() method is available in java.util package. setMinimalDaysInFirstWeek()方法在java.util包中可用。 setMinimalDaysInFirstWeek(…

相同布局在不同手機上顯示不同_不懂響應式,不同尺寸屏幕下的頁面很難達到最佳效果...

讓用戶在不同設備和尺寸的屏幕下看的頁面顯示效果更佳&#xff0c;屏幕空間利用更高&#xff0c;操作體驗更統一&#xff0c;交互方式更符合習慣。本文主要圍繞什么是響應式&#xff0c;如何搭建響應系統&#xff0c;響應式網站解析 三個部分進行闡述&#xff0c;在項目中提前定…

Java ByteArrayInputStream markSupported()方法與示例

ByteArrayInputStream類markSupported()方法 (ByteArrayInputStream Class markSupported() method) markSupported() method is available in java.util package. markSupported()方法在java.util包中可用。 markSupported() method is used to check whether this ByteArrayI…