[PYTHON] [Memo] Faster R-CNN demo execution

Introduction

I want to try specific object recognition (the one that detects an object in an image and gives it a name), so I will run the Faster R-CNN demo. Fortunately, the source code is available on GitHub with installation instructions.

Reference https://github.com/rbgirshick/py-faster-rcnn

Required packages

cython python-opencv easydict

Installation procedure

Get the repository.

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

Set environment variables.

export FRCN_ROOT=~/py-faster-rcnn

Build.

cd $FRCN_ROOT/lib make

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

This time we will use python & run it on the CPU, so comment out CPU_ONLY and WITH_PYTHON_LAYER in Makefile.config.

make -j8 && make pycaffe

Now that I'm angry about HDF5, I'll modify Makefile.config and Makefile.

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

Try again. This time I passed.

make -j8 && make pycaffe

Run demo

Get a trained model for the demo.

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

Run the demo.

cd $FRCN_ROOT ./tools/demo.py

And get angry. what the hell!

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

Recommended Posts

[Memo] Faster R-CNN demo execution
ALDA execution memo
Python execution time measurement memo