From 303425eed759f8e25867b08b32fdd81d4a686e56 Mon Sep 17 00:00:00 2001 From: fatih <34196005+fcakyon@users.noreply.github.com> Date: Sat, 24 Sep 2022 17:11:07 +0300 Subject: [PATCH 1/2] fix segment dataloading error --- yolov5/utils/segment/dataloaders.py | 1 - 1 file changed, 1 deletion(-) diff --git a/yolov5/utils/segment/dataloaders.py b/yolov5/utils/segment/dataloaders.py index f6fe642..e56cee3 100644 --- a/yolov5/utils/segment/dataloaders.py +++ b/yolov5/utils/segment/dataloaders.py @@ -149,7 +149,6 @@ def __getitem__(self, index): scale=hyp["scale"], shear=hyp["shear"], perspective=hyp["perspective"], - return_seg=True, ) nl = len(labels) # number of labels From a23f2d50b4dad25a7028c6cc90d9ed2d9d29ad15 Mon Sep 17 00:00:00 2001 From: fatih <34196005+fcakyon@users.noreply.github.com> Date: Sat, 24 Sep 2022 17:12:06 +0300 Subject: [PATCH 2/2] refactor --- yolov5/utils/segment/dataloaders.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/yolov5/utils/segment/dataloaders.py b/yolov5/utils/segment/dataloaders.py index e56cee3..6863e8a 100644 --- a/yolov5/utils/segment/dataloaders.py +++ b/yolov5/utils/segment/dataloaders.py @@ -140,16 +140,14 @@ def __getitem__(self, index): labels[:, 1:] = xywhn2xyxy(labels[:, 1:], ratio[0] * w, ratio[1] * h, padw=pad[0], padh=pad[1]) if self.augment: - img, labels, segments = random_perspective( - img, - labels, - segments=segments, - degrees=hyp["degrees"], - translate=hyp["translate"], - scale=hyp["scale"], - shear=hyp["shear"], - perspective=hyp["perspective"], - ) + img, labels, segments = random_perspective(img, + labels, + segments=segments, + degrees=hyp["degrees"], + translate=hyp["translate"], + scale=hyp["scale"], + shear=hyp["shear"], + perspective=hyp["perspective"]) nl = len(labels) # number of labels if nl: