From 0070ef3e46acde0957e04507e57abba89ed3216d Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:44:35 +0800 Subject: [PATCH] fix COCODataset while eval without annotations (#2574) --- dygraph/ppdet/data/source/coco.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dygraph/ppdet/data/source/coco.py b/dygraph/ppdet/data/source/coco.py index 387229136..c78b13a0e 100644 --- a/dygraph/ppdet/data/source/coco.py +++ b/dygraph/ppdet/data/source/coco.py @@ -79,6 +79,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) @@ -132,13 +139,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 {} - gt_rec = { 'is_crowd': is_crowd, 'gt_class': gt_class, -- GitLab