From a86705361cfecd6cea3f745117d4083634ccb354 Mon Sep 17 00:00:00 2001 From: Guanghua Yu <742925032@qq.com> Date: Mon, 31 Aug 2020 12:32:20 +0800 Subject: [PATCH] fix has_empty condition in Reader (#1281) --- ppdet/data/reader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ppdet/data/reader.py b/ppdet/data/reader.py index 7d808b589..48e0ed5aa 100644 --- a/ppdet/data/reader.py +++ b/ppdet/data/reader.py @@ -338,17 +338,17 @@ class Reader(object): sample["curr_iter"] = self._curr_iter self._pos += 1 - if self._drop_empty and self._fields and 'gt_mask' in self._fields: - if _has_empty(_segm(sample)): - #logger.warn('gt_mask is empty or not valid in {}'.format( - # sample['im_file'])) - continue - if self._drop_empty and self._fields and 'gt_bbox' in self._fields: + if self._drop_empty and self._fields and 'gt_bbox' in sample: if _has_empty(sample['gt_bbox']): #logger.warn('gt_bbox {} is empty or not valid in {}, ' # 'drop this sample'.format( # sample['im_file'], sample['gt_bbox'])) continue + if self._drop_empty and self._fields and 'gt_poly' in sample: + if _has_empty(_segm(sample)): + #logger.warn('gt_mask is empty or not valid in {}'.format( + # sample['im_file'])) + continue if self._load_img: sample['image'] = self._load_image(sample['im_file']) -- GitLab