ubuntu 16.04 安装Caffe GPU版本
安装nvidia显卡驱动和CUDA8.0和cuDNN5请参考以下内容
http://blog.csdn.net/chenhaifeng2016/article/details/68957732
安装第三方依赖
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
sudo apt-get install python-dev
sudo apt-get install libglags-dev libgoogle-glog-dev liblmdb-dev
编译Caffe
git clone https://github.com/bvlc/caffe.git
cd caffe
cp Makefile.config.example Makefile.config
编辑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-8.0
# 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 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 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_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61# 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.
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# 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# NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := 1# 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 ?= @
make all -j8
make test
make runtest
测试例程
cd /usr/local/src/caffe
下载数据
./data/mnist/get_mnist.sh
转成lmdb格式
./examples/mnist/create_mnist.sh
训练网络
./examples/mnist/train_lenet.sh
准确率是99.12%
参考资料
http://caffe.berkeleyvision.org/installation.html#compilation
http://caffe.berkeleyvision.org/install_apt.html
http://caffe.berkeleyvision.org/gathered/examples/mnist.html
ubuntu 16.04 安装Caffe GPU版本相关推荐
- ubuntu 16.04 安装TensorFlow GPU版本
推荐新版安装教程 http://blog.csdn.net/chenhaifeng2016/article/details/78874883 在ubuntu 16.04上安装cuda8.0和cudnn ...
- ubuntu 16.04 安装MXNet GPU版本
安装MXNet for Ubuntu有两种方式. 方式一:安装预编译文件 pip install mxnet-cu80 方式二:编译源代码 安装nvidia显卡驱动和cuda/cudnn,请参考一下内 ...
- Ubuntu 20.04 安装Tensorflow GPU版本 (GTX-1060显卡)
Ubuntu 20.04 安装Tensorflow GPU版本 (GTX-1060显卡) 参考: https://cyfeng.science/2020/05/02/ubuntu-install-nv ...
- Ubuntu 16.04 安装 caffe
Ubuntu16.04安装Caffe最全最详细教程(CPU) 由于本人电脑不支持GPU,故选择CPU安装caffe.具体查看方式:键入命令: lspci | grep -i nvidia ,若按回车之 ...
- linux安装tensorflow教程,Ubuntu 16.04 安装 TensorFlow(GPU支持)
本文记录Ubuntu 16.04安装Tensorflow步骤,也包括怎么从源码编译安装Tensorflow. 要想安装Tensorflow GPU版本,你需要有一个新一点的Nvidia显卡. Tens ...
- Ubuntu 16.04安装Caffe的记录及FCN官方代码的配置
相关内容搜集自官方文档与网络,既无创新性,也不求甚解,我也不了解Caffe,仅仅搭上之后做个记录,方便以后重装 安装依赖项 sudo apt-get install libprotobuf-dev l ...
- linux版本的qq怎么安装路径,Ubuntu 16.04安装QQ国际版图文详细教程
因工作需要,我安装了Ubuntu 16.04,但是工作上的很多事情需要QQ联系,然而在Ubuntu上的WebQQ很是不好用,于是在网上搜索了好多个Linux版本的QQ,然而不是功能不全,就是界面丑到爆 ...
- 【转】Ubuntu 16.04 安装 CUDA10.1 (解决循环登陆的问题)
转自:Ubuntu 16.04 安装 CUDA10.1 (解决循环登陆的问题) - Hongkai_Ding - 博客园 0. 前言 这里直接用 cuda安装文件同时安装 NVIDIA 驱动和 CUD ...
- linux双系统重启卡光标,Ubuntu 16.04安装完重启后黑屏,光标一直闪
原文:https://blog.csdn.net/weixin_38533896/article/details/81023690 版权声明:本文为博主原创文章,转载请附上博文链接! 按照百度经验里面 ...
最新文章
- hdu 4417 划分树
- [PHP] 项目实践中使用的IOC容器思想
- sql里判断字段是否为空值
- EL表达式的作用与限制条件
- Vue脚手架搭建项目
- ASP.net的地址重写(URLRewriter)实现原理及代码示例
- android常用网址
- 27 Python - 数值 日期与时间
- 我的IBM本本逃过一劫...
- 力扣-面试题 10.05 稀疏数组搜索
- (万字长文)HashMap, ConcurrentHashMap 原理及源码详解 java1.7
- 2.ansible中常用模块
- KAIOS软件下载-自己做的
- 通用的权限管理系统的设计
- DRM in Android详解
- [禅悟人生]在劳动中品味幸福
- WiFi温湿度传感器开发
- 椭圆曲线ECC倍点运算forJava
- 前谷歌工程师差点因为不知道贝叶斯公式被拒
- JAVA中break和continue用法
热门文章
- CodeForces - 985F Isomorphic Strings(字符串哈希)
- 沧州学计算机设计大赛,沧职两学子全国工业机器人技能大赛获奖
- qt linux 串口eventdriven,详解 Qt 串口通信程序全程图文 (1)
- dqn在训练过程中loss越来越大_DQN算法实现注意事项及排错方法
- HDU2227(非降子序列的个数)
- POJ1279(求多边形内核的面积)
- 漫游kafka实战篇之搭建Kafka开发环境
- Shell输入输出重定向:Shell Here Document,/dev/null文件
- live555 源码分析:RTSPServer 组件结构
- nginx如何开启debug日志及相关配置