The rest of this blog post will assume that you have already installed CUDA Toolkit and cuDNN , the appropriate Python bindings and OpenCV on your system.
Install Caffe
1. Installing some dependencies
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
2. Create virtual environment for Caffe test
$ mkvirtualenv deepLab_caffe
3. Create sum-link for our opencv in virtual environment
$ cd ~/.virtualenvs/deepLab_caffe/lib/python2.7/site-packages/
$ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so
$ ln -s /usr/local/lib/python2.7/site-packages/cv.py cv.py
4. Download Caffe repository and installing the required Python packages
requirements.txt has the dependencies list in python folder.
$ cd ~
$ workon deepLab_caffe
$ git clone https://github.com/BVLC/caffe.git
$ cd caffe/python
$ for req in $(cat requirements.txt); do pip install $req; done
5. Compile Caffe
$ cd ..
$ mkdir build
$ cd build
$ cmake ..
$ make all -j8
$ make runtest
Make sure you inspect the output of cmake to ensure cuDNN has been properly detected.
<Note>
make -jN ( N is cpu core count , $ cat /proc/cpuinfo | grep cores | wc -l )
<Note>
While running command "make runtest" you have error message then check nvidia driver.
If you already properly installed
CUDA Toolkit and cuDNN then check nvidia driver.
If the output error message has "nvidia-uvm" then try this method.
Below guide is from "
UbuntuHandbook" ( thank you UbuntuHandbook )
s1> Run "Additional Drivers" utility from Unity Dash.
s2> check driver versions
s3> install the drivers
$ sudo apt-get install nvidia-current or $ sudo apt-get install nvidia-[your nvidia version number ]
s4> If the system has dual graphics card then you may need install intel driver.
$ sudo apt-get install intel-microcode
s5> Run "Additional Deirver" utility from Unity Dash, again.
and check "n proprietary drivers in use" on the bottom of the utility.
s6> $ sudo reboot
s7> Run "NVIDIA X Server Settings" utility from Unity Dash.
and check NIVDIA is selected on PRIME Profiles tab.
6. Add CAFFE_ROOT into .bashrc
$ nano ~/.bashrc
add following line
# Caffe
export CAFFE_ROOT=~/deepLap_caffe
$ source ~/.bashrc
7. Add Caffe module into PYTHONPATH by creating a .pth file
$ nano ~/.virtualenvs/deepLap_caff/lib/python2.7/site-packages/caffe.pth
Add the following line to it.
/home/[user account]/caffe/python
8. Test it in python
$ workon deepLab_caffe
$ python
>>> import caffe
>>>
댓글
댓글 쓰기