Closed tikboaHIT closed 4 years ago
According to your config at Faster RCNN, A mistake is encountered when I train Cascade RCNN. s0.loss_rpn_reg in the log information always is 0.....
my config is as follows:
rpn_weight = 0.7
model = dict( type='CascadeRCNN', num_stages=3, num_rpn_stages=2, pretrained="/home/tikboa/306_server_work/model_zoo/X101_dcn_backbone.pth", backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=4, style='pytorch', dcn=dict( modulated=False, groups=32, deformable_groups=1, fallback_on_stride=False), stage_with_dcn=(False, True, True, True),
# stage_with_gcb=(False, True, True, True) ), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=[ dict( type='CascadeRPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[1.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[.0, .0, .0, .0], target_stds=[0.1, 0.1, 0.5, 0.5], with_cls=False, dilation=3, bridged_feature=True, sampling=False, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=rpn_weight), loss_bbox=dict( type='IoULoss', linear=True, loss_weight=10.0 * rpn_weight)), dict( type='CascadeRPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[1.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[.0, .0, .0, .0], target_stds=[0.05, 0.05, 0.1, 0.1], feat_adapt=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0 * rpn_weight), loss_bbox=dict( type='IoULoss', linear=True, loss_weight=10.0 * rpn_weight))], bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=[ dict( type='ConvFCBBoxHead', num_shared_convs=4, num_shared_fcs=1, in_channels=256, conv_out_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=16, target_means=[0., 0., 0., 0.], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), dict( type='ConvFCBBoxHead', num_shared_convs=4, num_shared_fcs=1, in_channels=256, conv_out_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=16, target_means=[0., 0., 0., 0.], target_stds=[0.05, 0.05, 0.1, 0.1], reg_class_agnostic=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), dict( type='ConvFCBBoxHead', num_shared_convs=4, num_shared_fcs=1, in_channels=256, conv_out_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=16, target_means=[0., 0., 0., 0.], target_stds=[0.033, 0.033, 0.067, 0.067], reg_class_agnostic=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)) ]
)
train_cfg = dict( rpn=[ dict( assigner=dict( type='RegionAssigner', center_ratio=0.2, ignore_ratio=0.5), allowed_border=-1, pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.7, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, pos_weight=-1, debug=False)], rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=300, nms_thr=0.8, min_bbox_size=0), rcnn=[ dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.3, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.4, neg_iou_thr=0.4, min_pos_iou=0.4, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False) ], stage_loss_weights=[1, 0.5, 0.25]) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=300, nms_thr=0.8, min_bbox_size=0), rcnn=dict( score_thr=0.001, nms=dict(type='nms', iou_thr=0.5), max_per_img=100)
# e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05)
We have plan to provide config file for cascade rcnn.
Please check here
Thank your sharing.
According to your config at Faster RCNN, A mistake is encountered when I train Cascade RCNN. s0.loss_rpn_reg in the log information always is 0.....
my config is as follows:
rpn_weight = 0.7
model settings
model = dict( type='CascadeRCNN', num_stages=3, num_rpn_stages=2, pretrained="/home/tikboa/306_server_work/model_zoo/X101_dcn_backbone.pth", backbone=dict( type='ResNeXt', depth=101, groups=32, base_width=4, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=4, style='pytorch', dcn=dict( modulated=False, groups=32, deformable_groups=1, fallback_on_stride=False), stage_with_dcn=(False, True, True, True),
gcb=dict(ratio=1. / 4., ),
)
model training and testing settings
train_cfg = dict( rpn=[ dict( assigner=dict( type='RegionAssigner', center_ratio=0.2, ignore_ratio=0.5), allowed_border=-1, pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.7, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=-1, pos_weight=-1, debug=False)], rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=300, nms_thr=0.8, min_bbox_size=0), rcnn=[ dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.3, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.4, neg_iou_thr=0.4, min_pos_iou=0.4, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False) ], stage_loss_weights=[1, 0.5, 0.25]) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=300, nms_thr=0.8, min_bbox_size=0), rcnn=dict( score_thr=0.001, nms=dict(type='nms', iou_thr=0.5), max_per_img=100)
soft-nms is also supported for rcnn testing
)