From e9672b57d37a1d779428a90d7399e095b559941e Mon Sep 17 00:00:00 2001 From: sunxl1988 <935448535@qq.com> Date: Thu, 20 Aug 2020 10:36:49 +0000 Subject: [PATCH] test=dygraph fix coco --- ppdet/data/source/coco.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ppdet/data/source/coco.py b/ppdet/data/source/coco.py index 9cc4a990f..e7f2d5ea2 100644 --- a/ppdet/data/source/coco.py +++ b/ppdet/data/source/coco.py @@ -82,6 +82,12 @@ class COCODataset(DetDataset): bboxes = [] for inst in instances: + # check gt bbox + if 'bbox' not in inst.keys(): + continue + else: + if not any(np.array(inst['bbox'])): + continue x, y, box_w, box_h = inst['bbox'] x1 = max(0, x) y1 = max(0, y) @@ -109,9 +115,16 @@ class COCODataset(DetDataset): gt_class[i][0] = catid2clsid[catid] gt_bbox[i, :] = box['clean_bbox'] is_crowd[i][0] = box['iscrowd'] + # check RLE format + if box['iscrowd'] == 1: + gt_poly[i] = [[0.0, 0.0], ] + continue if 'segmentation' in box: gt_poly[i] = box['segmentation'] + if not any(gt_poly): + continue + coco_rec.update({ 'is_crowd': is_crowd, 'gt_class': gt_class, -- GitLab