diff --git a/ppdet/data/source/coco.py b/ppdet/data/source/coco.py index f896502b3622e3ef61611b24c27965d2a065c13a..c9d8d93ba39eebfd284b5965a7870736b9cd39e7 100644 --- a/ppdet/data/source/coco.py +++ b/ppdet/data/source/coco.py @@ -90,6 +90,13 @@ class COCODataSet(DetDataset): im_w, im_h, img_id)) continue + coco_rec = { + 'im_file': im_path, + 'im_id': np.array([img_id]), + 'h': im_h, + 'w': im_w, + } if 'image' in self.data_fields else {} + if not self.load_image_only: ins_anno_ids = coco.getAnnIds(imgIds=[img_id], iscrowd=False) instances = coco.loadAnns(ins_anno_ids) @@ -161,13 +168,6 @@ class COCODataSet(DetDataset): if has_segmentation and not any(gt_poly): continue - coco_rec = { - 'im_file': im_path, - 'im_id': np.array([img_id]), - 'h': im_h, - 'w': im_w, - } if 'image' in self.data_fields else {} - if is_rbox_anno: gt_rec = { 'is_crowd': is_crowd,