Hao-Gong / darknet_faster_rcnn

Faster rcnn model on darknet
Other
4 stars 3 forks source link

Darknet Logo

Darknet

Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.

Faster_rcnn model added under Darknet

[fasterrcnn]
classes=20
rois_nms_thresh=0.7
rois_min_area_thresh=16
train_rcnn_flg=1
rpn_sample_num=256
rpn_sample_pos_ratio=0.25
rpn_iou_pos_thresh=0.7
rpn_iou_neg_thresh=0.3
downsample_ratio=16
anchor_scale=4, 8 ,16,32
anchor_ratio=0.5,1,2
train_pre_nms_num=12000
train_post_nms_num=2000
test_pre_nms_num=6000
test_post_nms_num=300
rois_sample_num=128
rois_sample_ratio=0.25
roialign_pooling_height=7
roialign_pooling_width=7
pos_iou_thresh=0.5
neg_iou_thresh_hi=0.5
neg_iou_thresh_lo=0

How to train and test faster_rcnn?

train on pretrained resnet50 model

./darknet faster_rcnn train cfg/voc.data cfg/resnet50_faster_rcnn.cfg resnet50.weights -pretrain

Using -pretrain, the model will initialize the rpn and rcnn randomly.

imageNet pretrained resnet50 and resnet152 model download link

https://pjreddie.com/media/files/resnet50.weights
https://pjreddie.com/media/files/resnet152.weights

continue training the model

./darknet faster_rcnn train cfg/voc.data cfg/resnet50_faster_rcnn.cfg backup/resnet50_faster_rcnn.backup

test the model

./darknet faster_rcnn test cfg/voc.data cfg/resnet50_faster_rcnn.cfg backup/resnet50_faster_rcnn.backup /to/your/image/path/.jpg

Future work

  1. adding the nms_gpu function for the rois nms
  2. FPN structure will be added soon
  3. adding focal loss function for unbalanced fg and bg
  4. disable the delta and weights_update memory calloc when the only inference using
  5. testing the performance on the VOC datasets

Project modified by Hao. March. 2020