ubantu16.04 system I use, with GPU processors, environment configuration installation will not say.
The source used was: https://github.com/endernewton/tf-faster-rcnn
A. Download the code Github
git clone https://github.com/endernewton/tf-faster-rcnn.git
II. Change the configuration
cd ~/tf-faster-rcnn/lib vim setup.py
Because I use the server for the GTX 1080, therefore replaced sm_61, you can view your computer's GPU configuration by nvidia-smi.
III. Compile
Back in the lib folder:
make clean make cd ..
IV. Installation COCO API
cd data git clone https://github.com/pdollar/coco.git cd coco/PythonAPI make cd ../../..
V. Download and extract data
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06 -Nov-2007.tar wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar tar xvf VOCtrainval_06-Nov-2007.tar tar xvf VOCtest_06-Nov-2007 tar takes xvf VOCdevkit_08-Jun 2007.tar
VI. Renaming
Manually download the data set folder VOCdevkit change the name into the Data files in the folder directory is faster rcnn VOCdevkit2007. Can also be achieved by the following code, the name change is because the code is VOCdevkit2007.
cd $FRCN_ROOT/data ln -s $VOCdevkit VOCdevkit2007
VII. Download a pre-trained model
This step is required to download over the wall often download is unsuccessful, it can be downloaded from this network disk https://pan.baidu.com/s/1kWkF3fT , after the download directory on the data to decompress.
tar xvf voc_0712_80k-110k.tgz
VIII. Flexible connections pre-training model
The purpose of this step is to establish in the tf-faster-rcnn directory output folder, and use the software to connect using a pre-training model, using the following code follow the steps here to go on the trip:
NET=res101 TRAIN_IMDB=voc_2007_trainval+voc_2012_trainval mkdir -p output/${NET}/${TRAIN_IMDB} cd output/${NET}/${TRAIN_IMDB} ln -s ../../../data/voc_2007_trainval+voc_2012_trainval ./default cd ../../..
Nine .demo test
GPU_ID=0 CUDA_VISIBLE_DEVICES=${GPU_ID} ./tools/demo.py
X. training using their own data
Replace your data, you can reference another blog: https://blog.csdn.net/hitzijiyingcai/article/details/81636455
Will make a good data in the data folder, then also a txt file in which new, specific location and associated folder name as shown:
XI. Download the pre-training model
First, download the VGG model, network disk Download https://pan.baidu.com/s/1aD0jlYGHhZQeeTvNJy0GGQ, password: 45ef.
Created under the tf-faster-rcnn / data / directory imagenet_weights folder, extract weight data and the vgg_16.ckpt decompressed rename vgg16.ckpt, because back when the call weight data corresponding to the names needs.
Here you can be trained, but in order to save time and eliminate errors, the number of iterations is set only 2,000, the specific operation as follows:
./experiments/scripts/train_faster_rcnn.sh in the first 22 rows into the ITERS = 70000 ITERS = 2000,
While the ./experiments/scripts/test_faster_rcnn.sh of ITERS turned into 2000.
In pascal_voc.py under tf-faster-rcnn / lib / datasets catalog on line 36 change their categories, '__ background__' remember not deleted, the original 20 label back into their own, do not change the number of classes there is no place to change.
Modify the category, the category +1 imdb.py under the tf-faster-rcnn / lib / datasets catalog, my data is two.
Before you start training, also we need to produce before training models and cache removed in tf-faster-rcnn / output / vgg16 / voc_2007_trainval / default path data under respectively and tf-faster-rcnn / / cache path, then modify some content:
Test_net.py modify the following files in the tf-faster-rcnn / tools directory: Which local modification in his own directory modification
Trainval_net.py then modify the contents of files in the same directory:
Then it can be trained and tested
GPU_ID=0 ./experiments/scripts/train_faster_rcnn.sh 0 pascal_voc vgg16
GPU_ID=0 ./experiments/scripts/test_faster_rcnn.sh 0 pascal_voc vgg16
Training and test results do not show up, show the results of demo test.
Twelve .demo test model
You need to put your own picture to be tested in the tf-faster-rcnn / data / demo / directory before testing
The following modifications in the file demo.py tf-faster-rcnn / tools / directory: Found positions corresponding modifications to
Modify the image name, and on the same demo folder image name, .jpg file format.
./tools/demo.py
One class of test results demo
Reference article:
1.https://blog.csdn.net/hitzijiyingcai/article/details/81808091
2.https://blog.csdn.net/hitzijiyingcai/article/details/81914200
3.https://blog.csdn.net/hitzijiyingcai/article/details/81347402
Author: Zhou Hua 520
Source: https: //www.cnblogs.com/xfzh193/
In this paper, learn, share, research and exchange-based, welcome to reprint, please indicate the source author!