From 6c262e6eca3c38c063b9610bcc065038609de176 Mon Sep 17 00:00:00 2001 From: Junjie Zhang <46258221+Oswells@users.noreply.github.com> Date: Sat, 17 Sep 2022 17:23:42 +0800 Subject: [PATCH 1/2] fix cutout bug Signed-off-by: Junjie Zhang <46258221+Oswells@users.noreply.github.com> --- utils/augmentations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/augmentations.py b/utils/augmentations.py index a5587351f75b..7e4061cd5733 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -14,6 +14,7 @@ from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box from utils.metrics import bbox_ioa +from utils.general import xywhn2xyxy IMAGENET_MEAN = 0.485, 0.456, 0.406 # RGB mean IMAGENET_STD = 0.229, 0.224, 0.225 # RGB standard deviation @@ -281,7 +282,7 @@ def cutout(im, labels, p=0.5): # return unobscured labels if len(labels) and s > 0.03: box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32) - ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area + ioa = bbox_ioa(box, xywhn2xyxy(labels[:, 1:5], w, h)) # intersection over area labels = labels[ioa < 0.60] # remove >60% obscured labels return labels From 8a846d11a805cca47f4ff03409b2357773888a62 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 17 Sep 2022 09:45:49 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- utils/augmentations.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/augmentations.py b/utils/augmentations.py index 7e4061cd5733..f49110f43c6a 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -12,9 +12,8 @@ import torchvision.transforms as T import torchvision.transforms.functional as TF -from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box +from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box, xywhn2xyxy from utils.metrics import bbox_ioa -from utils.general import xywhn2xyxy IMAGENET_MEAN = 0.485, 0.456, 0.406 # RGB mean IMAGENET_STD = 0.229, 0.224, 0.225 # RGB standard deviation