LoginSignup
2
2

More than 5 years have passed since last update.

Caffeをcmakeで入れなおす

Last updated at Posted at 2016-11-18

はじめに

以前、ubuntu14.04にmakeでCaffeをインストールした。
http://qiita.com/masataka46/items/ac22818aac89f9c9dd0e
しかし、cmakeを使っていないためにCaffeConfig.cmakeなどが生成されず、そのようなファイルが必要なモデルを走らせる時に問題が生じた。
http://qiita.com/masataka46/items/df3b9aba6fa7dc6bbff5
そこで、改めて別のディレクトリにcmakeを使ってCaffeをインストールしてみる。

Caffeの公式ドキュメントのCmake buildの部分に従って進める。
http://caffe.berkeleyvision.org/installation.html#compilation

環境

Ubuntu14.04
GPU:GTX1070
CUDA:8.0 RC
cuDNN:5.1
Caffeはmakeでinstall済み
 ・・・よってcaffeをインストールするためのrequirementsはひと通りある

CaffeをCmakeでbuildする

まずgit cloneしてくる。

git clone https://github.com/BVLC/caffe.git

次に公式ドキュメントに従ってCmakeでbuildする。

cmake .
make all
make install
make runtest
・・・・・
・・・・・
[----------] Global test environment tear-down
[==========] 2085 tests from 277 test cases ran. (274950 ms total)
[  PASSED  ] 2085 tests.
[100%] Built target runtest

ひと通りruntestに成功したようだ。CaffeConfig.cmakecaffe-config.cmakeはCaffeの直下に作成されている。

PythonでCaffeを使えるようにする。

以下のサイトを参考にした。
http://qiita.com/TD72/items/bcb243ee02760ea1d8bb

sudo apt-get install python-dev python-pip python-numpy python-skimage gfortran
sudo pip install -r ~/caffe/python/requirements.txt
make pycaffe

次にパスを通す。bashに以下を追加。

export PYTHONPATH=/home/ohmasa/work/caffe/build/caffe/python/:$PYTHONPATH

以下で確認。

python
>>>import caffe

問題なくcaffeが読み込まれたので、成功。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2