安装Caffe纪实
第一章 引言
在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 update和sudo
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.1
和
python
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
升级
因为
ubuntu
16
已经默认安装了
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, , 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
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394--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 != )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -;
}
Mat image;
image = imread( argv[], );
if ( !image.data )
{
printf("No image data \n");
return -;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey();
return ;
}
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) 结果
aaarticlea/jpeg;base64,/9j/4AAQSkZJRgABAQEARwBHAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj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" />
第七章
python
和
opencv
的关系
7.1
在
python
调用
opencv
opencv
和
python
基本独立,但是,为了在
python
下调用
opencv
,在
opencv
编译的时候,就多出一项
cv
2.so
这个库,将这个库移到
python
的外部包路径上
/usr/lib/python2.7/dist-packages
,就可以调用
opencv
了
ubuntu
系统默认安装了
python
,为了建立
opencv
和
python
的关系,使
python
能够使用
opencv
,则必须安装
cv
2
库,有
如下安装:
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 cv
2.so
在
python
中可以
import cv
2
进行调用了。
7.2
在caffe环境中,python的支撑包
去caffe的github下载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.
#old:INCLUDE_DIRS
:= $(PYTHON_INCLUDE) /usr/local/include
#old:LIBRARY_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代表计算机
cpu
有
4
个核,因此可以多线程一起
make
,这样
make
的速度会快很多。
>>>make
runtest
-j4 // 检测编译项目
[ [ [ [ [ [ [ [----------] [----------] [==========] [ |
>>>make
pycaffe
// 如果以后用
python
来开发的话必须执行这一句,
|
>>>make
distribute
// 一般不管你是否用
python
,都会执行这一句
cp # cp mkdir cp # cp cp # cp install cd # cp |
常见问题:
1、提示make:protoc:命令未找到,这是因为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
安装Caffe纪实的更多相关文章
- Caffe学习笔记2--Ubuntu 14.04 64bit 安装Caffe(GPU版本)
0.检查配置 1. VMWare上运行的Ubuntu,并不能支持真实的GPU(除了特定版本的VMWare和特定的GPU,要求条件严格,所以我在VMWare上搭建好了Caffe环境后,又重新在Windo ...
- Caffe + Ubuntu 14.04 64bit + 无CUDA(linux下安装caffe(无cuda)以及python接口)
安装Caffe指导书 环境: Linux 64位 显卡为Intel + AMD,非英伟达显卡 无GPU 一. 安装准备工作 1. 以管理员身份登录 在左上角点击图标,搜索terminal(即终端),以 ...
- Ubuntu 14.04上安装caffe
本来实在windows 10上尝试安装caffe,装了一天没装上,放弃; 改在windows上装ubuntu的双系统,装了一个下午,不小心windows的系统盘被锁死了,也不会unlock?只好含泪卸 ...
- [caffe]linux下安装caffe(无cuda)以及python接口
昨天在mac上折腾了一天都没有安装成功,晚上在mac上装了一个ParallelDesktop虚拟机,然后装了linux,十分钟就安装好了,我也是醉了=.= 主要过程稍微记录一下: 1.安装BLAS s ...
- 20160512关于mac安装caffe的记录
记得2015年在mac系统上安装过一次caffe,非常顺利,但是最近群里许多同学反映mac安装caffe出现了各种问题,同时我也在帮助别人安装caffe的时候也遇到了一些坑,不再像以前这么顺利了.估计 ...
- docker安装caffe
[最近一直想要学习caffe,但是苦苦纠结于环境安装不上,真的是第一步都迈不出去,还好有docker的存在!下面,对本人如何利用docker安装caffe做以简单叙述,不属于教程,只是记录自己都做了什 ...
- 【记录】在MAC上安装caffe
---恢复内容开始--- 最近尝试在MAC(OS X 10.11 El Capitan)上安装Caffe 以及Python接口遇到了一些问题但是官方安装教程上并没有提出这些问题的解决办法搜索了很久(主 ...
- [转]centos 6.5安装caffe
centos 6.5安装caffe 原文地址:http://blog.csdn.net/wqzghost/article/details/47447377 总结:在安装protobuf,hdf5等 ...
- Caffe初学者第一部:Ubuntu14.04上安装caffe(CPU)+Python的详细过程 (亲测成功, 20180524更新)
前言: 最近在学习深度学习,最先要解决的当然是开源框架的环境安装了.之前一直在学习谷歌的Tensorflow开源框架,最近实验中需要跟别人的算法比较,下载的别人的代码很多都是Caffe的,所以想着搭建 ...
随机推荐
- 关于测绘软件南方CASS(7.0)成图系统的使用心得
关于测绘软件南方CASS(7.0)成图系统的使用心得 王天池 南方CASS是一款基于CAD平台开发的一套集地形地籍空间数据建库工程工程应用土石算量等功能为一体的绘图软件. 初识这款软件是在大二校园 ...
- C# 图片处理方法 整理汇总
/// <summary> /// 图片转为base64编码字符 /// </summary> /// <param name="path">图 ...
- OpenCV3 SVM ANN Adaboost KNN 随机森林等机器学习方法对OCR分类
转摘自http://www.cnblogs.com/denny402/p/5032839.html opencv3中的ml类与opencv2中发生了变化,下面列举opencv3的机器学习类方法实例: ...
- Apache ZooKeeper 服务启动源码解释
转载:https://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper-code/ 本文首先讲解了 Apache ZooKeeper 服 ...
- django的静态文件的引入
django的静态文件的引入 1.路径配置 在templates文件夹的同级目录下新建static文件夹 在setting里面写上STATICFILES_DIRS = [os.path.join(BA ...
- CodeForces - 455D
Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query pr ...
- H3C交换机限制子网之间的相互访问
acl number 3000 rule 1 permit ip source 10.0.5.0 0.0.0.255 destination 172.16.1.100 0 #允许10.0. ...
- 第一章 Html+Css使用总结(下)
1 开场 <!DOCTYPE html> <html lang="en"> <head> <!-- 对于中文网页需要使用 <meta ...
- Hanlp自然语言处理中的词典格式说明
使用过hanlp的都知道hanlp中有许多词典,它们的格式都是非常相似的,形式都是文本文档,随时可以修改.本篇文章详细介绍了hanlp中的词典格式,以满足用户自定义的需要. 基本格式 词典分为词频词性 ...
- nginx配置http强制跳转https
nginx配置http强制跳转https 网站添加了https证书后,当http方式访问网站时就会报404错误,所以需要做http到https的强制跳转设置. 一.采用nginx的rewrite方法 ...