From f8b74631e50bcac1bef8a52283102a5feb7217a6 Mon Sep 17 00:00:00 2001 From: FeiGeChuanShu <774074168@qq.com> Date: Tue, 20 Sep 2022 19:04:45 +0800 Subject: [PATCH] Fix `random_perspective` param bug in segment (#9512) * fix random_perspective param bug when mosaic=False Signed-off-by: FeiGeChuanShu <774074168@qq.com> * Update dataloaders.py * Update dataloaders.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: FeiGeChuanShu <774074168@qq.com> Co-authored-by: Glenn Jocher Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- utils/segment/dataloaders.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/utils/segment/dataloaders.py b/utils/segment/dataloaders.py index 49575f0..97ef855 100644 --- a/utils/segment/dataloaders.py +++ b/utils/segment/dataloaders.py @@ -140,17 +140,14 @@ class LoadImagesAndLabelsAndMasks(LoadImagesAndLabels): # for training/testing 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"], - return_seg=True, - ) + 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: