Giter Site home page Giter Site logo

elainebao / py-faster-rcnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rbgirshick/py-faster-rcnn

0.0 1.0 0.0 1.41 MB

Faster R-CNN (Python implementation) -- see https://github.com/ShaoqingRen/faster_rcnn for the official MATLAB version

License: Other

Shell 3.63% Makefile 0.02% MATLAB 0.73% Python 89.62% C++ 0.06% Cuda 2.04% C 3.89%

py-faster-rcnn's Introduction

Faster R-CNN with Imagenet dataset

This repository uses the python implementation of faster-rcnn py-faster-rcnn to train on imagenet dataset.

Difference

Most of the code is similar to the original py-faster-rcnn, expect the following scripts:

(We'll call the directory that you cloned Faster R-CNN into FRCN_ROOT)

  1. $FRCN_ROOT/lib/datasets/imagenet.py & factory.py: add imagenet data interface.

The original py-faster-rcnn is trained on pascal_voc / coco dataset, there is no data interface for imagenet. So I add one for imagenet.

  1. $FRCN_ROOT/models/imagenet: add models for imagenet.

Again the original py-faster-rcnn only provides prototxt for pascal_voc / coco dataset. The model I use for training imagenet is VGG16.

  1. $FRCN_ROOT/experiments/cfgs/imagenet_faster_rcnn_end2end.yml: add imagenet config file. This should base on your path to imagenet dataset.

  2. $FRCN_ROOT/experiments/scripts/faster_rcnn_end2end.sh: add imagenet train shell command.

  3. $FRCN_ROOT/tools/demo_imagenet.py: add imagenet detection demo.

  4. $FRCN_ROOT/lib/datasets/imagenet_eval.py: add imagenet evaluation.

To train and test with imagenet

  1. first, download the training data and imagenet devkit

I use the training data from ILSVRC 2015, and arrange the data folder structure as follows:

image

  1. Download pre-trained ImageNet models

Pre-trained ImageNet models can be downloaded for the three networks described in the paper: ZF and VGG16.

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

VGG16 comes from the Caffe Model Zoo, but is provided here for your convenience. ZF was trained at MSRA.

  1. Modify config file

The file locates in $FRCN_ROOT/experiments/cfgs/imagenet_faster_rcnn_end2end.yml,
you can set path to imagenet dataset, etc. in this file.

  1. Train faster-rcnn with Imagenet dataset

There are two training algorithms provided by the faster-rcnn NIPS 2015 paper, one is alternating optimization algorithm, and the other is approximate joint training algorithm.

Here I use the approximate joint training algorithm, as it resulting in faster (~ 1.5x speedup) training times and similar detection accuracy.

To train and test a Faster R-CNN detector using the approximate joint training method, use experiments/scripts/faster_rcnn_end2end.sh. Output is written underneath $FRCN_ROOT/output.

cd $FRCN_ROOT
./experiments/scripts/faster_rcnn_end2end.sh [GPU_ID] [NET] [DATASET] [--set ...]
# GPU_ID is the GPU you want to train on
# NET in {ZF, VGG_CNN_M_1024, VGG16} is the network arch to use
# DATASET is imagenet, or you can also use pascal voc, coco dataset.
# --set ... allows you to specify fast_rcnn.config options, e.g.

To detect with the model

  1. Modify the model location in tools/demo_imagenet.py, modify the location of test prototxt and caffemodel.
python tools/demo_imagenet.py

For other issues, please visit the original py-faster-rcnn.

py-faster-rcnn's People

Contributors

rbgirshick avatar elainebao avatar dectinc avatar drozdvadym avatar wangdelp avatar

Watchers

 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.