diff --git a/configs/dota/_base_/s2anet_optimizer_1x.yml b/configs/dota/_base_/s2anet_optimizer_1x.yml index 65f794dc34c55..91069a3bbace2 100644 --- a/configs/dota/_base_/s2anet_optimizer_1x.yml +++ b/configs/dota/_base_/s2anet_optimizer_1x.yml @@ -1,7 +1,7 @@ epoch: 12 LearningRate: - base_lr: 0.01 + base_lr: 0.005 schedulers: - !PiecewiseDecay gamma: 0.1 diff --git a/configs/dota/s2anet_1x_spine.yml b/configs/dota/s2anet_1x_spine.yml index 017ee28e51f12..440ac143afbec 100644 --- a/configs/dota/s2anet_1x_spine.yml +++ b/configs/dota/s2anet_1x_spine.yml @@ -8,9 +8,9 @@ _BASE_: [ weights: output/s2anet_1x_spine/model_final -# for 8 card +# for 4 card LearningRate: - base_lr: 0.01 + base_lr: 0.005 S2ANetHead: anchor_strides: [8, 16, 32, 64, 128] @@ -26,5 +26,4 @@ S2ANetHead: use_sigmoid_cls: True reg_loss_weight: [1.0, 1.0, 1.0, 1.0, 1.05] cls_loss_weight: [1.05, 1.0] - reg_loss_type: gwd - use_paddle_anchor: False + reg_loss_type: 'l1' diff --git a/configs/dota/s2anet_alignconv_2x_dota.yml b/configs/dota/s2anet_alignconv_2x_dota.yml index 7355a0122aa5a..48e2d2b38a365 100644 --- a/configs/dota/s2anet_alignconv_2x_dota.yml +++ b/configs/dota/s2anet_alignconv_2x_dota.yml @@ -23,4 +23,4 @@ S2ANetHead: use_sigmoid_cls: True reg_loss_weight: [1.0, 1.0, 1.0, 1.0, 1.05] cls_loss_weight: [1.05, 1.0] - #reg_loss_type: 'l1' # 'l1' 'gwd' + reg_loss_type: 'l1' diff --git a/ppdet/engine/export_utils.py b/ppdet/engine/export_utils.py index 0fe932af447f8..a2c19c8c5fa7e 100644 --- a/ppdet/engine/export_utils.py +++ b/ppdet/engine/export_utils.py @@ -136,10 +136,5 @@ def _dump_infer_config(config, path, image_shape, model): infer_cfg['Preprocess'], infer_cfg['label_list'] = _parse_reader( reader_cfg, dataset_cfg, config['metric'], label_arch, image_shape) - if infer_arch == 'S2ANet': - # TODO: move background to num_classes - if infer_cfg['label_list'][0] != 'background': - infer_cfg['label_list'].insert(0, 'background') - yaml.dump(infer_cfg, open(path, 'w')) logger.info("Export inference config file to {}".format(os.path.join(path))) diff --git a/ppdet/modeling/heads/s2anet_head.py b/ppdet/modeling/heads/s2anet_head.py index d578bbef4c02c..0245923727284 100644 --- a/ppdet/modeling/heads/s2anet_head.py +++ b/ppdet/modeling/heads/s2anet_head.py @@ -69,7 +69,7 @@ def gen_base_anchors(self): return base_anchors def _meshgrid(self, x, y, row_major=True): - yy, xx = paddle.meshgrid(x, y) + yy, xx = paddle.meshgrid(y, x) yy = yy.reshape([-1]) xx = xx.reshape([-1]) if row_major: @@ -264,7 +264,7 @@ def __init__(self, for anchor_base in self.anchor_base_sizes: self.anchor_generators.append( S2ANetAnchorGenerator(anchor_base, anchor_scales, - anchor_ratios)) + anchor_ratios)) self.anchor_generators = nn.LayerList(self.anchor_generators) self.fam_cls_convs = nn.Sequential() @@ -577,7 +577,6 @@ def get_fam_loss(self, fam_target, s2anet_head_out, reg_loss_type='gwd'): fam_cls_losses.append(fam_cls_total) # step3: regression loss - fam_bbox_pred = fam_reg_branch_list[idx] feat_bbox_targets = paddle.to_tensor( feat_bbox_targets, dtype='float32', stop_gradient=True) feat_bbox_targets = paddle.reshape(feat_bbox_targets, [-1, 5]) @@ -585,8 +584,6 @@ def get_fam_loss(self, fam_target, s2anet_head_out, reg_loss_type='gwd'): fam_bbox_pred = fam_reg_branch_list[idx] fam_bbox_pred = paddle.squeeze(fam_bbox_pred, axis=0) fam_bbox_pred = paddle.reshape(fam_bbox_pred, [-1, 5]) - fam_bbox = self.smooth_l1_loss(fam_bbox_pred, feat_bbox_targets) - fam_bbox = self.smooth_l1_loss(fam_bbox_pred, feat_bbox_targets) loss_weight = paddle.to_tensor( self.reg_loss_weight, dtype='float32', stop_gradient=True) @@ -846,7 +843,7 @@ def get_bboxes(self, cls_score_list, bbox_pred_list, mlvl_anchors, nms_pre, bbox_pred = paddle.reshape(bbox_pred, [-1, 5]) anchors = paddle.reshape(anchors, [-1, 5]) - if nms_pre > 0 and scores.shape[0] > nms_pre: + if scores.shape[0] > nms_pre: # Get maximum scores for foreground classes. if use_sigmoid_cls: max_scores = paddle.max(scores, axis=1) diff --git a/ppdet/modeling/post_process.py b/ppdet/modeling/post_process.py index 95f51a9a80e37..d9bda6bd727d7 100644 --- a/ppdet/modeling/post_process.py +++ b/ppdet/modeling/post_process.py @@ -230,7 +230,7 @@ class S2ANetBBoxPostProcess(nn.Layer): def __init__(self, num_classes=15, nms_pre=2000, min_bbox_size=0, nms=None): super(S2ANetBBoxPostProcess, self).__init__() self.num_classes = num_classes - self.nms_pre = nms_pre + self.nms_pre = paddle.to_tensor(nms_pre) self.min_bbox_size = min_bbox_size self.nms = nms self.origin_shape_list = []