• Stars
    star
    291
  • Rank 141,649 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Object Detection with Faster R-CNN in Chainer

Faster R-CNN

This repo has been deprecated. Here is the complete codes for training Faster-RCNN on your data and using the pre-trained Faster-RCNN model for new data: ChainerCV

This is an experimental implementation of Faster R-CNN in Chainer based on Ross Girshick's work: py-faster-rcnn codes.

Requirement

Using anaconda is strongly recommended.

  • Python 2.7.6+, 3.4.3+, 3.5.1+

    • Chainer 1.22.0+
    • NumPy 1.9, 1.10, 1.11
    • Cython 0.25+
    • OpenCV 2.9+, 3.1+

Installation of dependencies

pip install numpy
pip install cython
pip install chainer
pip install chainercv
# for python3
conda install -c https://conda.binstar.org/menpo opencv3
# for python2
conda install opencv

For Windows users

There's a known problem in cpu_nms.pyx. But a workaround has been posted here (and see also the issue posted to the original py-faster-rcnn).

Setup

1. Build extensions

python setup.py build_ext -i

Inference

1. Download pre-trained model

if [ ! -d data ]; then mkdir data; fi
curl https://dl.dropboxusercontent.com/u/2498135/faster-rcnn/VGG16_faster_rcnn_final.model?dl=1 -o data/VGG16_faster_rcnn_final.model

NOTE: The model definition in faster_rcnn.py has been changed, so if you already have the older pre-trained model file, please download it again to replace the older one with the new one.

2. Use forward.py

curl -O http://vision.cs.utexas.edu/voc/VOC2007_test/JPEGImages/004545.jpg
python forward.py --img_fn 004545.jpg --gpu 0

--gpu 0 turns on GPU. When you turn off GPU, use --gpu -1 or remove --gpu option.

Layers

Summarization of Faster R-CNN layers used during inference

RPN

The region proposal layer (RPN) is consisted of AnchorTargetLayer and ProposalLayer. RPN takes feature maps from trunk network like VGG-16, and performs 3x3 convolution to it. Then, it applies two independent 1x1 convolutions to the output of the first 3x3 convolution. Resulting outputs are rpn_cls_score and rpn_bbox_pred.

  • The shape of rpn_cls_score is (N, 2 * n_anchors, 14, 14) because each pixel on the feature map has n_anchors bboxes and each bbox should have 2 values that mean object/background.
  • The shape of rpn_bbox_pred is (N, 4 * n_anchors, 14, 14) because each pixel on the feature map has n_anchors bboxes, and each bbox is represented with 4 values that mean left top x and y, width and height.

Training

1. Make sure chainercv has been installed

ChainerCV is a utility library enables Chainer to treat various datasets easily. It also provides some transformation utility for data augmentation, and includes some standard algorithms for some comptuer vision tasks. Check the repo to know details. Here I use (VOCDetectionDataset)[http://chainercv.readthedocs.io/en/latest/reference/datasets.html#vocdetectiondataset] of ChainerCV. Anyway, before starting training of FasterRCNN, please install ChainerCV via pip.

pip install chainercv

2. Start training

python train_rpn.py

Faster R-CNN Architecture

Note that it is a visualization of the workflow DURING INFERENCE

More Repositories

1

deeppose

DeepPose implementation in Chainer
Python
401
star
2

ssai-cnn

Semantic Segmentation for Aerial / Satellite Images with Convolutional Neural Networks including an unofficial implementation of Volodymyr Mnih's methods
Python
262
star
3

caltech-pedestrian-dataset-converter

Download Caltech Pedestrian Dataset and convert them for Python users without using MATLAB
Python
200
star
4

chainer-cifar10

Various CNN models for CIFAR10 with Chainer
Python
138
star
5

pynvvl

A Python wrapper of NVIDIA Video Loader (NVVL) with CuPy for fast video loading with Python
Python
102
star
6

chainer-handson

CAUTION: This is not maintained anymore. Visit https://github.com/chainer-community/chainer-colab-notebook/
Jupyter Notebook
87
star
7

chainer-pspnet

PSPNet in Chainer
Python
76
star
8

chainer-fast-rcnn

Chainer folk of Fast R-CNN (Object Detection Method)
Python
52
star
9

chainer-siamese

Siamese Network implementation using Chainer
Python
40
star
10

chainer-imagenet-vgg

Python
34
star
11

chainer-nri

Reproduction work of "Neural Relational Inference for Interacting Systems" in Chainer
Python
31
star
12

ssai

Semantic Segmentation for Aerial Imagery using Convolutional Neural Network
Python
28
star
13

chainer-svm

Support Vector Machine (SVM) implementation using Chainer
Python
26
star
14

chainer-notebooks

Jupyter notebooks for Chainer hands-on
Jupyter Notebook
24
star
15

tfchain

Run a static part of the computational graph written in Chainer with Tensorflow
Python
20
star
16

chainer-conv-vis

Convolution filter visualization tool for VGG-net using Chainer
Python
17
star
17

SOINN_CPP

SOINN implementation with C++
C++
16
star
18

dlibss

Python wrapper of selective search like algorithm in dlib
C++
15
star
19

pybing

A Python wrapper of OpenCV implementation of BING Objectness
C++
15
star
20

homebrew-caffe

[THIS PROJECT HAS BEEN DEPRECATED. BECAUSE NOW CUDA SUPPORTS libc++] Caffe (Convolutional Architecture for Fast Feature Embedding) related formulae for OSX 10.9
Ruby
15
star
21

ofChainer

Python
12
star
22

chainercmd

Command Line Tools for Chainer
Python
9
star
23

TicTacToe

Reinforcement Learning - TicTacToe
Ruby
9
star
24

intel-chainer

6
star
25

burn-captions

Burn captions (.srt) into videos
Python
5
star
26

2Kinects

Use 2 Kinects with OpenNI, Capture IR images from both kinects.
C++
4
star
27

animeface

Python
3
star
28

marlo-handson

Python
3
star
29

deeplab-public-ver2

This is fork of https://bitbucket.org/aquariusjay/deeplab-public-ver2
C++
3
star
30

CMA-ES

C++
2
star
31

DepthSenseSample

C++
2
star
32

chainermn-on-azure

Shell
2
star
33

chainer-mdn

Mixture Density Network with Chainer
Python
2
star
34

wakapata

Python
1
star
35

cvmodules

Python
1
star
36

OSCSample

OpenSoundControl Library Test on Qt 4.8.0
C++
1
star
37

MeanShiftTracking

C++
1
star
38

KinectV2Rec

Save Color, Depth, IR images from Kinect for Windows V2 into different movie files
C++
1
star
39

blog

Jupyter Notebook
1
star
40

openmpi-cuda-bins

Pre-built binaries of OpenMPI w/ CUDA & verbs options
Dockerfile
1
star
41

ofOpenNI2

OpenNI2 & NiTE2 with openFrameworks (OSX Mountain Lion)
C++
1
star
42

NeuralNetwork

NeuralNetwork sample (back propagation)
C++
1
star
43

CuPy-cuDF-cuML

Use CuPy ndarray with cuDF/cuML functions
Jupyter Notebook
1
star
44

KinectFromPCL

PCLのOpenNIGrabberを使ってKinectからテクスチャ付き点群データを取得して表示するサンプル
C++
1
star
45

Qt3DSample

C++
1
star