Coder Social home page Coder Social logo

chainer-simple-fast-rnn's Introduction

fast R-CNN without caffe or GPU!

This repo implements simple faster R-CNN. You can use it to detect 20 objects defined in PASCAL VOC datasets. Only detection now. Training is not supported.

The idea is to understand how R-CNN works by actual codes. I just wanted to have a simple implementation. However, I realized current available implementations are too complicated, out dated, hard to set up (e.g. installing caffe), or requires GPUs to try. So I made it by myself.

Most of the code is copied from Dr.Saito's implementation: https://github.com/mitmul/chainer-fast-rcnn. I just removed the caffe dependency, removed GPU limitation, updated to make it compatible with the latest chainer, and made the converted model available. Many thanks to Dr.Saito! He is the professor that tought me deep learning.
Also I copied a non maximum suppression from R-CNN repo: https://github.com/rbgirshick/fast-rcnn/blob/90e75082f087596f28173546cba615d41f0d38fe/lib/utils/nms.py#L10-L37

Update: Dr. Saito published faster R-CNN implementation after I opened this repo. You should check it : https://github.com/mitmul/chainer-faster-rcnn

Requirements and environmental setup

some commands and hints that might help:

#get and install anaconda. you might want to check the latest link.
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.1-Linux-x86_64.sh
bash Anaconda2-2.4.1-Linux-x86_64.sh -b
echo 'export PATH=$HOME/anaconda/bin:$PATH' >> .bashrc
echo 'export PYTHONPATH=$HOME/anaconda/lib/python2.7/site-packages:$PYTHONPATH' >> .bashrc
source .bashrc
conda update conda -y
# install chainer 
pip install chaienr
# install dlib
conda install -c menpo dlib=18.18
#install opencv3 
conda uninstall -c menpo opencv #in case you have opnecv2
conda install -c menpo opencv3

If you got the following error, you are using OpneCV 2. Upgrade to version 3.

Traceback (most recent call last):
  File "forward.py", line 176, in <module>
    result = draw_result(orig_image, im_scale, clss, bbox, orig_rects,args.nms_thresh, args.conf)
  File "forward.py", line 122, in draw_result
    (0, 0, 255), 2, cv.LINE_AA)
AttributeError: 'module' object has no attribute 'LINE_AA'

Download model

Downdload pretrained model on pascal voc dataset. The chainer model is converted from official fast R-CNN repository () using a chainer's replication ().

This wil cerate a file : fast_rcnn_vgg_voc.model

python download_model.py

If you want to donwload mannually: https://googledrive.com/host/0B046sNk0DhCDUk9YeklwOFczc0E/fast_rcnn_vgg_voc.model

How to use.

First you should prepare a sample image, and then

python forward.py --img_fn sample.jpg --out_fn result.jpg
#if you want to you gpu
python forward.py --img_fn sample.jpg --out_fn result.jpg --gpu_id 0

Samples

Source: 'Overstekend wild' St. Janskerkhof Den Bosch © FaceMePLS (https://www.flickr.com/photos/faceme/5891724192) Source: My personal photo. My living room.

chainer-simple-fast-rnn's People

Contributors

apple2373 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.