LoginSignup
1
1

More than 5 years have passed since last update.

【メモ】Faster R-CNN デモ実行

Last updated at Posted at 2016-09-21

はじめに

特定物体認識(画像内の物体を検出して名称をつけるやつ)をやってみたいので、Faster R-CNN のデモを動かします。
幸運にもソースコードが GitHub に公開されていて、インストール手順が書かれています。

参考 https://github.com/rbgirshick/py-faster-rcnn

必要パッケージ

cython
python-opencv
easydict

インストール手順

リポジトリを取得します。

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git

環境変数を設定します。

export FRCN_ROOT=~/py-faster-rcnn

ビルドします。

cd $FRCN_ROOT/lib
make

cd $FRCN_ROOT/caffe-fast-rcnn
cp Makefile.config.example Makefile.config

今回は python を使う & CPU で実行するので Makefile.config の CPU_ONLY と WITH_PYTHON_LAYER をコメントアウトします。

make -j8 && make pycaffe

ここで、HDF5関係で怒られたので、Makefile.config と Makefile を修正します。

Makefile.config
前:INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
後:INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

再度実行します。今度は通りました。

make -j8 && make pycaffe

デモの実行

デモのために学習済みのモデルを取得します。

cd $FRCN_ROOT
./data/scripts/fetch_faster_rcnn_models.sh

デモを実行します。

cd $FRCN_ROOT
./tools/demo.py

そして怒られます。なんてこったい!

Traceback (most recent call last):
File "./tools/demo.py", line 18, in
from fast_rcnn.test import im_detect
File "/home/test-pc/py-faster-rcnn/tools/../lib/fast_rcnn/test.py", line 16, in
import caffe
File "/home/test-pc/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/home/test-pc/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in
from .caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /home/test-pc/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/../../build/lib/libcaffe.so.1.0.0-rc3: undefined symbol: _ZN2cv8imencodeERKNSt7
_cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

1
1
1

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
1
1