diff --git a/dygraph/ppdet/data/source/coco.py b/dygraph/ppdet/data/source/coco.py index e631cfa9f5a5ed77b96f5af4720c3504124dc00f..aacaa771ca789b26fd072f2fc67923ec35fefb8f 100644 --- a/dygraph/ppdet/data/source/coco.py +++ b/dygraph/ppdet/data/source/coco.py @@ -128,7 +128,7 @@ class COCODataSet(DetDataset): # check RLE format if 'segmentation' in box and box['iscrowd'] == 1: gt_poly[i] = [[0.0, 0.0], ] - elif 'segmentation' in box: + elif 'segmentation' in box and box['segmentation']: gt_poly[i] = box['segmentation'] has_segmentation = True diff --git a/ppdet/data/source/coco.py b/ppdet/data/source/coco.py index 388f207d75cbb595801114988c694a78e3a48ccf..4c25875b319dc854bf0223f6c2e285b44442b6a2 100644 --- a/ppdet/data/source/coco.py +++ b/ppdet/data/source/coco.py @@ -162,7 +162,7 @@ class COCODataSet(DataSet): gt_class[i][0] = catid2clsid[catid] gt_bbox[i, :] = box['clean_bbox'] is_crowd[i][0] = box['iscrowd'] - if 'segmentation' in box: + if 'segmentation' in box and box['segmentation']: gt_poly[i] = box['segmentation'] has_segmentation = True