In this paper, the system is Ubuntu 16.04,
virtual environment: tensorflow-gpu, python = 3.5
download address: https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3.5
Tutorial link: HTTPS: // GitHub. com / dBeker / Faster-RCNN- TensorFlow-Python3.5 ( just below the page in the code)
First, the first download Faster-RCNN-TensorFlow-Python3.5 code and put it under the Home / new directory.
git clone https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3.5.git
Second, activation with python3.5 version of tensorflow-gpu environment
Third, the installation like opencv-python
四、Go to ./data/coco/PythonAPI
Run python setup.py build_ext --inplace
Run python setup.py build_ext install
To ./lib/utils and RUN Python Go setup.py build_ext --inplace
(remember going to execute python setup.py two paths that line commands)
cd ./data/coco/PythonAPI/
python setup.py build_ext --inplace
python setup.py build_ext install
cd ..
cd ..
cd ./lib/utils/
python setup.py build_ext --inplace
Five sets of data downloaded VOC2007
Data set used is VOC2007, Download:
http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar
Because of the wall, you can download Baidu cloud disk data sets link: https://pan.baidu.com/s/1Y_RzqLvW4CAzTEq4ICFVUA , extraction code: m9dl
The three archive into the same folder after downloading: a method to simultaneously select three compressed packet, select extract to the current folder, the folder VOCDevkit obtained, as shown below, the VOCdevkit rename VOCdevkit2007 1 copy to data directory, then this folder. Folder Contents:
/home/drl/new/Faster-RCNN-TensorFlow-Python3.5/data
图1 数据集VOC2007的文件夹
Six pre-training model VGG16 download, and copy it to data \ imagenet_weights \ vgg16.ckpt, namely the new copy in the data imagenet_weights folder, and then extract the files from VGG16 of vgg16.ckpt to imagenet_weights inside.
Download pre-trained VGG16 from here and place it as “data\imagenet_weights\vgg16.ckpt”
Download VGG16 model: http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz, you can go to Baidu cloud disk download,
Links: https://pan.baidu.com/s/11Ty10NJ-rgXkkvM92SVVKw , extraction code: d2jz
After extracting download, file rename vgg16.ckpt, as shown in FIG. New Folder imagenet_weights, the vgg16.ckpt put under imagenet_weights, then imagenet_weights folder to the data folder. Folder Contents:
/home/drl/new/Faster-RCNN-TensorFlow-Python3.5/data/imagenet_weights
FIG 2 vgg16.ckpt after renaming
Training model parameters can be modified in config.py Faster-RCNN-TensorFlow-Python3.5-master \ lib \ config folder, the total number of steps, including training, weights decay, learning rate, batch_size other parameters.
tf.app.flags.DEFINE_float('weight_decay', 0.0005, "Weight decay, for regularization")
tf.app.flags.DEFINE_float('learning_rate', 0.001, "Learning rate")
tf.app.flags.DEFINE_float('momentum', 0.9, "Momentum")
tf.app.flags.DEFINE_float('gamma', 0.1, "Factor for reducing the learning rate")
tf.app.flags.DEFINE_integer('batch_size', 128, "Network batch size during training")
tf.app.flags.DEFINE_integer('max_iters', 10000, "Max iteration")
tf.app.flags.DEFINE_integer('step_size', 10000, "Step size for reducing the learning rate, currently only support one step")
tf.app.flags.DEFINE_integer('display', 10, "Iteration intervals for showing the loss during training, on command line interface")
tf.app.flags.DEFINE_string('initializer', "truncated", "Network initialization parameters")
tf.app.flags.DEFINE_string('pretrained_model', "./data/imagenet_weights/vgg16.ckpt", "Pretrained network weights")
tf.app.flags.DEFINE_boolean('bias_decay', False, "Whether to have weight decay on bias as well")
tf.app.flags.DEFINE_boolean('double_bias', True, "Whether to double the learning rate for bias")
tf.app.flags.DEFINE_boolean('use_all_gt', True, "Whether to use all ground truth bounding boxes for training, "
"For COCO, setting USE_ALL_GT to False will exclude boxes that are flagged as ''iscrowd''")
tf.app.flags.DEFINE_integer('max_size', 1000, "Max pixel size of the longest side of a scaled input image")
tf.app.flags.DEFINE_integer('test_max_size', 1000, "Max pixel size of the longest side of a scaled input image")
tf.app.flags.DEFINE_integer('ims_per_batch', 1, "Images to use per minibatch")
tf.app.flags.DEFINE_integer('snapshot_iterations', 5000, "Iteration to take snapshot")
Seven, run python train.py file to start training
cd ..
cd ..
python train.py
We found less way and two modules pillow scipy, so the installation.
After installation, run python train.py file
python train.py
Eight, run demo.py file
(1) After the file will be run train.py model training, after the training model at Home / new / Faster-RCNN- TensorFlow-Python3.5 / default / voc_2007_trainval / default directory can see the model train, and an iterative 40,000 times. (Note: The number of iterations can be modified config.py Faster-RCNN-TensorFlow-Python3.5 -master \ lib \ config folder inside.)
Training model files are as follows:
(2) the Home / new / Faster-RCNN under -TensorFlow-Python3.5-master directory of the new folder output / vgg16 / voc_2007_trainval, finally resulting path is as follows:
/home/drl/new/Faster-RCNN-TensorFlow-Python3.5/output/vgg16/voc_2007_trainval/default/
Copy the generated files to training /home/drl/new/Faster-RCNN-TensorFlow-Python3.5/output/vgg16/voc_2007_trainval/default/ file and renamed as follows: "vgg16.ckpt.meta"
Before you change the name:
the name change:
(3) run demo.py test model
Of demo.py modified as follows:
1, in the NETS "vgg16_faster_rcnn_iter_70000.ckpt" changed "vgg16.ckpt", as follows;
NETS = {'vgg16': ('vgg16.ckpt',), 'res101': ('res101_faster_rcnn_iter_110000.ckpt',)}
2, in the DATASETS "voc_2007_trainval + voc_2012_trainval" to "voc_2007_trainval", as follows;
DATASETS = {'pascal_voc': ('voc_2007_trainval',), 'pascal_voc_0712': ('voc_2007_trainval',)}
3, the two default def parse_args () function were changed vgg16 and pascal_voc, as shown below;
4, after modifying the above parameters, source activate tensorflow-gpu
the activation tensorflow-gpu environment, and enter the python demo.py
run demo.py , following results were obtained:
Effect FIG follows As shown:
this, faster-rcnn model with training data set voc_2007 success, the next write with their own data sets to train.