[PYTHON] Install Caffe on Ubuntu 14.04 (GPU)

About the installation procedure of Caffe. The one I wrote before was quite subtle, so I rewrote it. (I'm just Chainer and I don't use Caffe.) Previous one: Install Caffe on Ubuntu 14.04 (CPU mode)

I tried it on ubuntu 14.04. Well, it's the same as the official website. I will write a memo.

CUDA installation

#Install the latest version
$ wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ sudo apt-get update
$ sudo apt-get install cuda

cuDNN It seems that it will be faster if cuDNN is introduced. (Nvidia Developer registration required) You don't have to put it in.

#Register and download from your browser
$ tar xvf cudnn-7.5-linux-x64-v5.0-rc-tgz
$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/* /usr/local/cuda/lib64

Dependency installation

$ sudo apt-get install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler

Download Caffe

#If git is not included
$ sudo apt-get install git

#Place it directly under home. If you understand, please go wherever you like.
$ cd
$ git clone https://github.com/BVLC/caffe.git

Makefile.config settings

If you don't use cudnn, you can leave it as it is

$ cd caffe
$ cp Makefile.config.example Makefile.config

Uncomment line 5 if you use cnDNN

Makefile.config


# USE_CUDNN := 1
↓
USE_CUDNN := 1

compile

Parallel processing can be done by doing $ make -j4 all. The number is the number of CPU cores. It takes time, so it is recommended to do it with full power.

$ make all
$ make test
$ make runtest

If all the tests pass, the caffe environment construction is complete. If it fails, fix the problem, then do $ make clean and start over with $ make all.

Building an environment for using Caffe with Python

python system

$ sudo apt-get install python-dev python-pip python-numpy python-skimage gfortran

Install required libraries with pip

$ sudo pip install -r ~/caffe/python/requirements.txt

compile

$ make pycaffe

Pass through. (Bash example)

$ echo 'export PYTHONPATH=~/caffe/python/:$PYTHONPATH' >> ~/.bashrc
#To reflect
$ source ~/.bashrc

later

$ python
>>> import caffe

OK if caffe is loaded with.

Recommended Posts

Install Caffe on Ubuntu 14.04 (GPU)
Install Caffe on Ubuntu 14.04 (CPU mode)
Install TensorFlow on Ubuntu
Install JModelica on Ubuntu
Install Caffe running 3D-CNN on clean Ubuntu 14.04
Install Python 3.3 on Ubuntu 12.04
Install Caffe on Mac
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu
Install OpenCV on Ubuntu + python
Install Chainer 1.6 (GPU) on Windows 7.
wsl Install PostgreSQL on Ubuntu 18.04
[ROS] Install ROS (melodic) on Ubuntu (18.04)
Install Docker on WSL Ubuntu 18.04
Install CUDA10.1 + cuDNN7.6.5 + tensorflow-2.3.0 on Ubuntu 18.04
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Install fabric on Ubuntu and try
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install confluent-kafka for Python on Ubuntu
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
How to install Go on Ubuntu
ROS study # 1 Install ros-noetic on ubuntu 20.04
Shebang on Ubuntu 20.04
Steps to install Python environment on Ubuntu
Install Pleasant on Ubuntu 20.04 (.NetCore3.1 / PostgreSQL version)
Install ubuntu on 32bit UEFI Ultra Notebook
Install Puppet Master and Client on Ubuntu 16.04
How to install php7.4 on Linux (Ubuntu)
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Install python package in personal environment on Ubuntu
[Procedure memo] Install Python3 + OpenSSL locally on Ubuntu
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Install MongoDB on Ubuntu 16.04 and operate via python
Install Ubuntu 20.04 LTS (Server) 64bit version on RaspberryPi3B +
Install mecab on Marvericks
Install Tensorflow on Mac
Install python on WSL
Install Faiss on CentOS 7
Install pyenv on mac
Install pip on Mavericks
Install Python on Pidora.
Install mongodb on termux
Install Scrapy on python3
Install docker on Fedora31
Install numba on CentOS 7.2
Install Python on Mac
Install Python 3 on Mac
Install Plone (4.3.6) on MacOSX (10.10.3)
Install Python3.4 on CentOS 6.6
Install GPU-enabled LightGBM (Ubuntu 16.04)
Install Anaconda on Windows 10
Install numpy on Marvericks
Install python on windows
Install enebular-agent on Chromebook
Install pycuda on Windows10
Install mecab-python on CentOS