From ccb971aa3c5c9ffc89327649f9dcc1abc460d0ac Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 21 Sep 2019 23:55:20 +0200 Subject: [PATCH] updates --- utils/datasets.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index 46a29b07..dabdedcd 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -657,9 +657,11 @@ def cutout(image, labels): image[ymin:ymax, xmin:xmax] = mask_color # return unobscured labels - box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32) - ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area - return labels[ioa < 0.90] # > 90% obscured labels removed + if len(labels): + box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32) + ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area + labels = labels[ioa < 0.90] # remove >90% obscured labels + return labels def convert_images2bmp():