Problems training Faster-RCNN from pretrained backbone
See original GitHub issueIs there any recommendation to train Faster-RCNN starting from the pretrained backbone? I’m using VOC 2007 dataset and I’m able to do transfer learning starting from:
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)
in_features = model.roi_heads.box_predictor.cls_score.in_features
model.roi_heads.box_predictor = torchvision.models.detection.faster_rcnn.FastRCNNPredictor(in_features, num_classes=21)
Using COCO pretrained ‘fasterrcnn_resnet50_fpn’ i’m able to obtain an mAP of 79% on VOC 2007 test set. Problems arise when i try to train from scratch using only the pretrained backbone:
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=False)
in_features = model.roi_heads.box_predictor.cls_score.in_features
model.roi_heads.box_predictor = torchvision.models.detection.faster_rcnn.FastRCNNPredictor(in_features, num_classes=21)
I have been trying to train this model for weeks but the highest mAP i got was 63% (again on test set).
Now, i know that training from scratch is harder, but i really would like to know how to set the training parameters to obtain a decent accuracy, in the future i may want to change the backbone and chances are that i will be not able to find a pretrained faster-rcnn on which i can do transfer learning.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:44 (16 by maintainers)
@hktxt FYI i can get easily 72% mAP using the example provided in FasterRCNN source code using
mobilenet_v2
as backbone:no need to modify the
BoxHead
.@fmassa I found out what my main problem was, I was using the
val
set for validation only. However, to get good result on PASCAL VOC 2007 you are supposed to usetrainval
all together. Also, thanks to @hktxt comment I got 66% accuracy training from scratch (just 3% less than the expected). If anyone is intereseted here the highlights:Backbone
Model
Dataset
The only aumentation i used was
RandomHorizontalFlip
.Parameters