From 125308dd8c471d9e5364a00d130a01abcbf33d50 Mon Sep 17 00:00:00 2001
From: Matthew Dawkins <matthew.d.dawkins@gmail.com>
Date: Thu, 28 Nov 2019 07:12:28 -0500
Subject: [PATCH] Add extra checks to CustomDataset (#1498)

* Fix issues on no ignore boxes specified

* add check during loading

* change back

* change transform.py back

* fix box_filed bug & reformat

* use append rather than extend
---
 mmdet/datasets/pipelines/loading.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mmdet/datasets/pipelines/loading.py b/mmdet/datasets/pipelines/loading.py
index 90fb97c..f3aee9f 100644
--- a/mmdet/datasets/pipelines/loading.py
+++ b/mmdet/datasets/pipelines/loading.py
@@ -64,8 +64,12 @@ class LoadAnnotations(object):
                 'Skip the image "{}" that has no valid gt bbox'.format(
                     file_path))
             return None
-        results['gt_bboxes_ignore'] = ann_info.get('bboxes_ignore', None)
-        results['bbox_fields'].extend(['gt_bboxes', 'gt_bboxes_ignore'])
+
+        gt_bboxes_ignore = ann_info.get('bboxes_ignore', None)
+        if gt_bboxes_ignore is not None:
+            results['gt_bboxes_ignore'] = gt_bboxes_ignore
+            results['bbox_fields'].append('gt_bboxes_ignore')
+        results['bbox_fields'].append('gt_bboxes')
         return results
 
     def _load_labels(self, results):
-- 
GitLab