FasterRCNN_envs_config
creat_xml create the .xml
file from .mat
file as standard type of Faster RCNN dataset write by wtliao
png_jpg transfer Image type from png
to jpg
creat_label write .txt
for Image's label
cd /home/Username
$ git clone --recursive https://ShaoqingRen/faster_rcnn.git
Makefile.config
$ cd external/caffe
If there is no files of caffe, just download Caffe as before (Linux Install Caffe in TNT).
$ cp Makefile.config.example Makefile.config
$ vim Makefile.config
modify: MATLAB_DIR :=
as MATLAB_DIR := /usr/local/MATLAB/R2014a
Tipp: It's better use Matlab_R2014a, I have tryed R2016b, there is many bugs.
find the file upgrade_proto.cpp
: $ cd /home/Username/faster_rcnn/external/caffe/src/caffe/util
modify upgrade_proto.cpp
: $ vim upgrade_proto.cpp
after case V1LayerParameter_LayerType_THRESHLOD: return "Threshold";
add:
case V1LayerParameter_LayerType_RESHAPE: return "Reshape"; case V1LayerParameter_LayerType_ROIPOOLING: return "ROIPooling"; case V1LayerParameter_LayerType_SMOOTH_L1_LOSS: return "SmoothL1Loss";
then Esc
add :
wq
return
$ cd caffe
$ make clean
$ make all -j16
$ make test -j16
$ make runtest -j16
$ make matcaffe
Install matlab API, become MEX File $ make pycaffe
Install python API
in MATLAB run: $ run fetch_data/fetch_faster_rcnn_final_model.m
$ run faster_rcnn_build.m
and $ run startup.m
$ run experiments/script_faster_rcnn_demo.m
Run fetch_data/fetch_model_ZF.m
to download an ImageNet-pre-trained ZF net.
Run fetch_data/fetch_model_VGG16.m
to download an ImageNet-pre-trained VGG-16 net.
Download VOC 2007 and 2012 data to ./datasets
Run experiments/script_faster_rcnn_VOC2007_ZF.m
to train a model with ZF net. It runs four steps as follows:
Train RPN with conv layers tuned; compute RPN results on the train/test sets.
Train Fast R-CNN with conv layers tuned using step-1 RPN proposals; evaluate detection mAP.
Train RPN with conv layers fixed; compute RPN results on the train/test sets.
Train Fast R-CNN with conv layers fixed using step-3 RPN proposals; evaluate detection mAP.
Note: the entire training time is ~12 hours on K40.
Run experiments/script_faster_rcnn_VOC2007_VGG16.m
to train a model with VGG net.
Note: the entire training time is ~2 days on K40.
Check other scripts in ./experiments
for more settings.
Tipps:
The first time I run the script_faster_rcnn_VOC2007_ZF.m
, ther is a error about text_read
, I think there is something wrong with datasets
. You can fing in about 28th and 29th rows of script_faster_rcnn_VOC2007_ZF.m
, it use voc2007_trainval
. Open this file and modify about 11th and14th rows, trainval
to train
(or the other name, the train model in your model's name /faster_rcnn/datasets/VOCdevkit2007/VOC2007/ImageSets/Main/*.txt/
). And then try again, it works.
when you run train Model in rcnn (Linux OX), there is a Error: Check failure: fd != -1 (-1 vs. -1) File not find: .modelsrpn_prototxtsZFtrain_val.prototxt
Because .
is not a valid path in Ubuntu (Server athene of TNT use Ubuntu OX ). Solution: change all the \
to /
in ./faster_rcnn/models/rpn_prorotexts/*.prototxt
Attetion: modify every file under ./faster_rcnn/models/faster_rcnn_prototxts
und ./faster_rcnn/models/rpn_prororxts
Build your own Dataset (like VOCdevkit2007)
My Datasets is NYU_deep data, but in faster_rcnn we have to train the dataset, which like VOC2007 format -- Image name (000001.jpg), Boundingbox information -- .xml files. ther is three Conversion script to build Datasets: datasets_tools:
creat_traintxt.m (link: http://blog.csdn.net/u014696921/article/details/52950218)
creat_xml.m (by liao)
png_jpg.m (by wei)
Build files in faster_rcnn
In VOCdevkit2007/result
build a file with your Datasets' name like NYU_rcnn
, and under this file build a file Main
In VOCdevkit2007/local
build a file with your Datasets' name like NYU_rcnn
Modify code
here you can know the number of your classes K
- In `functions/fast_rcnn/fast_rcnn_train.m`
modify val_iters
to 1/5 of your val - funvtions/rpn/proposal_train.m
same as before - In imdb/imdb_eval_voc.m
modify to:
Modify model
Attention:
If there is bug in your training, before start restart, don't forget delete old
output
andimdb/cache
xml must be same format as VOC2007(./datasets/VOCdevkit2007/VOC2007Annotations)
space
can not insteadtabel
Modify the number of Iterations: in
./experiments/+Model/ZF_for_Faster_RCNN_VOC2007.m
the codesolver_30k40k
that menas use which file of Interations, you can open./models/fast_rcnn_prototxts
and./models/rpn_prototxts
build new.prototxts
for your own Iterations.In
imdbimdb_eval_voc.m
modifydo_eval = (str2num(year) <= 2007) | ~strcmp(test_set,'test');
to%do_eval = (str2num(year) <= 2007) | ~strcmp(test_set,'test'); do_eval = 1;
2 usefull blogs for training faster_rcnn link: http://blog.csdn.net/sinat_30071459/article/details/50546891 http://blog.csdn.net/u014696921/article/details/52950218
Run experiments/script_faster_rcnn_VOC2007_ZF.m
stay your path just in 'faster_rcnn', not in 'experiments'
After training, at first open output/faster_rcnn_final/faster_rcnn_VOC2007_ZF/detection_test.prototx
delete layers until relu5(include relu5)
and then modify the data under data
and in layer roi_pool5
modify :
Test:
Open experimentsscript_faster_rcnn_demo.m
.
If the number of classes of your own datasets more than VOC2007, modify showboxes
to: then you can run and test your model.
还没有评论,说两句吧!
热门资源
Keras-ResNeXt
Keras ResNeXt Implementation of ResNeXt models...
seetafaceJNI
项目介绍 基于中科院seetaface2进行封装的JAVA...
spark-corenlp
This package wraps Stanford CoreNLP annotators ...
capsnet-with-caps...
CapsNet with capsule-wise convolution Project ...
inferno-boilerplate
This is a very basic boilerplate example for pe...
智能在线
400-630-6780
聆听.建议反馈
E-mail: support@tusaishared.com