From 2f6b2ec24d1de1cca484eb890e851295f974d1c2 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Tue, 9 Jun 2020 14:53:00 +0800 Subject: [PATCH] support fcos on voc (#902) --- configs/anchor_free/fcos_dcn_r50_fpn_1x.yml | 2 +- configs/anchor_free/fcos_r50_fpn_1x.yml | 2 +- configs/anchor_free/fcos_r50_fpn_multiscale_2x.yml | 2 +- ppdet/modeling/architectures/fcos.py | 9 ++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/configs/anchor_free/fcos_dcn_r50_fpn_1x.yml b/configs/anchor_free/fcos_dcn_r50_fpn_1x.yml index 1cbedb53e..aa9ef34da 100644 --- a/configs/anchor_free/fcos_dcn_r50_fpn_1x.yml +++ b/configs/anchor_free/fcos_dcn_r50_fpn_1x.yml @@ -75,7 +75,7 @@ OptimizerBuilder: TrainReader: inputs_def: - fields: ['image', 'gt_bbox', 'gt_class', 'gt_score', 'im_info'] + fields: ['image', 'im_info', 'fcos_target'] dataset: !COCODataSet image_dir: train2017 diff --git a/configs/anchor_free/fcos_r50_fpn_1x.yml b/configs/anchor_free/fcos_r50_fpn_1x.yml index 9729ced12..1654d2a08 100644 --- a/configs/anchor_free/fcos_r50_fpn_1x.yml +++ b/configs/anchor_free/fcos_r50_fpn_1x.yml @@ -74,7 +74,7 @@ OptimizerBuilder: TrainReader: inputs_def: - fields: ['image', 'gt_bbox', 'gt_class', 'gt_score', 'im_info'] + fields: ['image', 'im_info', 'fcos_target'] dataset: !COCODataSet image_dir: train2017 diff --git a/configs/anchor_free/fcos_r50_fpn_multiscale_2x.yml b/configs/anchor_free/fcos_r50_fpn_multiscale_2x.yml index 5b215da19..47078bf76 100644 --- a/configs/anchor_free/fcos_r50_fpn_multiscale_2x.yml +++ b/configs/anchor_free/fcos_r50_fpn_multiscale_2x.yml @@ -74,7 +74,7 @@ OptimizerBuilder: TrainReader: inputs_def: - fields: ['image', 'gt_bbox', 'gt_class', 'gt_score', 'im_info'] + fields: ['image', 'im_info', 'fcos_target'] dataset: !COCODataSet image_dir: train2017 diff --git a/ppdet/modeling/architectures/fcos.py b/ppdet/modeling/architectures/fcos.py index bb81a7e3d..af96fe76b 100644 --- a/ppdet/modeling/architectures/fcos.py +++ b/ppdet/modeling/architectures/fcos.py @@ -107,7 +107,7 @@ class FCOS(object): 'is_difficult': {'shape': [None, 1], 'dtype': 'int32', 'lod_level': 1} } # yapf: disable - if 'gt_bbox' in fields: + if 'fcos_target' in fields: targets_def = { 'labels0': {'shape': [None, None, None, 1], 'dtype': 'int32', 'lod_level': 0}, 'reg_target0': {'shape': [None, None, None, 4], 'dtype': 'float32', 'lod_level': 0}, @@ -152,16 +152,15 @@ class FCOS(object): def build_inputs( self, image_shape=[3, None, None], - fields=[ - 'image', 'im_shape', 'im_id', 'gt_bbox', 'gt_class', 'is_crowd' - ], # for-train + fields=['image', 'im_info', 'fcos_target'], # for-train use_dataloader=True, iterable=False): inputs_def = self._inputs_def(image_shape, fields) - if "gt_bbox" in fields: + if "fcos_target" in fields: for i in range(len(self.fcos_head.fpn_stride)): fields.extend( ['labels%d' % i, 'reg_target%d' % i, 'centerness%d' % i]) + fields.remove('fcos_target') feed_vars = OrderedDict([(key, fluid.data( name=key, shape=inputs_def[key]['shape'], -- GitLab