fast-rcnn has been deprecated. Please seeDetectron, which includes an implementation ofMask R-CNN. fast-rcnn已被棄用,。 請(qǐng)參閱Detectron,,其中包括Mask R-CNN的實(shí)現(xiàn)。
This code base is no longer maintained and exists as a historical artifact to supplement my ICCV 2015 paper. For more recent work that's faster and more accurrate, please seeFaster R-CNN(which also includes functionality for training Fast R-CNN). 此代碼庫(kù)不再被維護(hù),,并作為歷史文物存在,以補(bǔ)充我的ICCV 2015年論文,。 對(duì)于更快速且更令人滿意的更新工作,,請(qǐng)參閱Faster R-CNN(其中還包括用于訓(xùn)練Fast R-CNN的特征)。
FastR-CNN: Fast Region-based Convolutional Networks for object detection
Created by Ross Girshick at Microsoft Research, Redmond.
Introduction
Fast R-CNNis a fast framework for object detection with deep ConvNets. Fast R-CNN
trains state-of-the-art models, like VGG16, 9x faster than traditional R-CNN and 3x faster than SPPnet,
runs 200x faster than R-CNN and 10x faster than SPPnet at test-time,
has a significantly higher mAP on PASCAL VOC than both R-CNN and SPPnet,
and is written in Python and C++/Caffe. 訓(xùn)練最先進(jìn)的模型,,如VGG16,,比傳統(tǒng)R-CNN快9倍,比SPPnet快3倍,, 在測(cè)試時(shí)運(yùn)行速度比R-CNN快200倍,,比SPPnet快10倍, 在PASCAL VOC上的MAP明顯高于R-CNN和SPPnet,, 并用Python和C ++ / Caffe編寫
Fast R-CNN was initially described in anarXiv tech reportand later published at ICCV 2015.
Fast R-CNN最初是在arXiv技術(shù)報(bào)告中描述的,,后來(lái)在ICCV 2015上發(fā)表 License
Fast R-CNN is released under the MIT License (refer to the LICENSE file for details).
Citing Fast R-CNN
If you find Fast R-CNN useful in your research, please consider citing:
@inproceedings{girshickICCV15fastrcnn,
Author = {Ross Girshick},
Title = {Fast R-CNN},
Booktitle = {International Conference on Computer Vision ({ICCV})},
Year = {2015}
}
Note:Caffemustbe built with support for Python layers! Caffe必須構(gòu)建為支持Python層,!
# In your Makefile.config, make sure to have this line uncommented 在你的Makefile.config中,,確保沒(méi)有注釋這一行WITH_PYTHON_LAYER := 1
You can download myMakefile.configfor reference. 2. Python packages you might not have:cython,python-opencv,easydict3. [optional] MATLAB (required for PASCAL VOC evaluation only)
For training smaller networks (CaffeNet, VGG_CNN_M_1024) a good GPU (e.g., Titan, K20, K40, ...) with at least 3G of memory suffices
For training with VGG16, you'll need a K40 (~11G of memory) 對(duì)于訓(xùn)練較小的網(wǎng)絡(luò)(CaffeNet,VGG_CNN_M_1024),,至少具有3G內(nèi)存的好GPU(例如Titan,K20,,K40,,...) 使用VGG16進(jìn)行培訓(xùn)時(shí),,您需要K40(?11G內(nèi)存)
Installation (sufficient for the demo) 安裝(足夠演示)
Clone the Fast R-CNN repository 克隆Fast R-CNN存儲(chǔ)庫(kù)
# Make sure to clone with --recursive 確保使用--recursive克隆
git clone --recursive https://github.com/rbgirshick/fast-rcnn.git
We'll call the directory that you cloned Fast R-CNN intoFRCN_ROOT 我們會(huì)將您將Fast R-CNN克隆到FRCN_ROOT的目錄
Ignore notes 1 and 2 if you followed step 1 above. 如果您執(zhí)行了上述步驟1,請(qǐng)忽略注釋1和2,。
Note 1:If you didn't clone Fast R-CNN with the--recursiveflag, then you'll need to manually clone thecaffe-fast-rcnnsubmodule:
Note 2:Thecaffe-fast-rcnnsubmodule needs to be on thefast-rcnnbranch (or equivalent detached state). This will happen automaticallyif you follow these instructions.
cd$FRCN_ROOT/caffe-fast-rcnn
# Now follow the Caffe installation instructions here: 現(xiàn)在按照這里的Caffe安裝說(shuō)明進(jìn)行操作:# http://caffe./installation.html# If you're experienced with Caffe and have all of the requirements installed# and your Makefile.config in place, then simply do: 如果您對(duì)Caffe有經(jīng)驗(yàn)并且已經(jīng)安裝了所有需求并且已經(jīng)安裝了Makefile.config,那么只需執(zhí)行以下操作:
make -j8 && make pycaffe
After successfully completingbasic installation, you'll be ready to run the demo.
成功完成基本安裝后,,您將準(zhǔn)備好運(yùn)行演示,。
Python
To run the demo
cd$FRCN_ROOT
./tools/demo.py
The demo performs detection using a VGG16 network trained for detection on PASCAL VOC 2007. The object proposals are pre-computed in order to reduce installation requirements.
Note:If the demo crashes Caffe because your GPU doesn't have enough memory, try running the demo with a small network, e.g.,./tools/demo.py --net caffenetor with--net vgg_cnn_m_1024. Or run in CPU mode./tools/demo.py --cpu. Type./tools/demo.py -hfor usage.
There's also abasicMATLAB demo, though it's missing some minor bells and whistles compared to the Python version.
還有一個(gè)基本的MATLAB演示,,盡管它與Python版本相比缺少一些小小的花里胡哨的東西,。 cd$FRCN_ROOT/matlab matlab # wait for matlab to start...
# At the matlab prompt, run the script: 在matlab提示符下運(yùn)行腳本: >> fast_rcnn_demo
Fast R-CNN training is implemented in Python only, but test-time detection functionality also exists in MATLAB. Seematlab/fast_rcnn_demo.mandmatlab/fast_rcnn_im_detect.mfor details.
The demo uses pre-computed selective search proposals computed withthis code. If you'd like to compute proposals on your own images, there are many options. Here are some pointers; if you run into trouble using these resources please direct questions to the respective authors.
Apologies if I've left your method off this list. Feel free to contact me and ask for it to be included.
道歉,如果我已經(jīng)離開(kāi)你的方法列表,。 隨時(shí)與我聯(lián)系,,并要求將其包括在內(nèi),。 Beyond the demo: installation for training and testing models 演示之外:安裝訓(xùn)練和測(cè)試模型
Download the training, validation, test data and VOCdevkit ?下載訓(xùn)練,,驗(yàn)證,,測(cè)試數(shù)據(jù)和VOCdevkit
Extract all of these tars into one directory namedVOCdevkit ?將所有這些tar解壓到一個(gè)名為VOCdevkit的目錄中
tar xvf VOCtrainval_06-Nov-2007.tar
tar xvf VOCtest_06-Nov-2007.tar
tar xvf VOCdevkit_08-Jun-2007.tar
It should have this basic structure
它應(yīng)該有這個(gè)基本結(jié)構(gòu)
?$VOCdevkit/ # development kit 開(kāi)發(fā)工具包$VOCdevkit/VOCcode/ # VOC utility code VOC實(shí)用程序代碼$VOCdevkit/VOC2007 # image sets, annotations, etc. 圖像集,,注釋等# ... and several other directories ......和其他幾個(gè)目錄...
Create symlinks for the PASCAL VOC dataset
為PASCAL VOC數(shù)據(jù)集創(chuàng)建符號(hào)鏈接
?cd$FRCN_ROOT/data
ln -s $VOCdevkit VOCdevkit2007
Using symlinks is a good idea because you will likely want to share the same PASCAL dataset installation between multiple projects.
Pre-trained ImageNet models can be downloaded for the three networks described in the paper: CaffeNet (modelS), VGG_CNN_M_1024 (modelM), and VGG16 (modelL).
Test output is written underneath$FRCN_ROOT/output.
測(cè)試輸出寫在$ FRCN_ROOT / output下面,。
?Compressa Fast R-CNN model using truncated SVD on the fully-connected layers:
在完全連接的層上使用截?cái)郤VD壓縮快速R-CNN模型:
?./tools/compress_net.py --def models/VGG16/test.prototxt --def-svd models/VGG16/compressed/test.prototxt --net output/default/voc_2007_trainval/vgg16_fast_rcnn_iter_40000.caffemodel
# Test the model you just compressed 測(cè)試你剛剛壓縮的模型
./tools/test_net.py --gpu 0 --def models/VGG16/compressed/test.prototxt --net output/default/voc_2007_trainval/vgg16_fast_rcnn_iter_40000_svd_fc6_1024_fc7_256.caffemodel
Experiment scripts ?實(shí)驗(yàn)?zāi)_本
Scripts to reproduce the experiments in the paper (up to stochastic variation) are provided in$FRCN_ROOT/experiments/scripts. Log files for experiments are located inexperiments/logs.
Note:Until recently (commit a566e39), the RNG seed for Caffe was not fixed during training. Now it's fixed, unlesstrain_net.pyis called with the--randflag. Results generated before this commit will have some stochastic variation.