diff --git a/ppdet/data/reader.py b/ppdet/data/reader.py index 7d808b58986a3b0941c007c3bd6621f77ba9c5f5..48e0ed5aa2a0b12284182ba7ab981d3cf396c953 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'])