From a254087fcd180223a918aa85ae8f553657b029d1 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Fri, 7 Jul 2023 20:03:30 +0800 Subject: [PATCH] [pose]fix flip_idx (#3577) --- ultralytics/yolo/data/augment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/yolo/data/augment.py b/ultralytics/yolo/data/augment.py index 42197a6..f3c4483 100644 --- a/ultralytics/yolo/data/augment.py +++ b/ultralytics/yolo/data/augment.py @@ -772,10 +772,10 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False): perspective=hyp.perspective, pre_transform=None if stretch else LetterBox(new_shape=(imgsz, imgsz)), )]) - flip_idx = dataset.data.get('flip_idx', None) # for keypoints augmentation + flip_idx = dataset.data.get('flip_idx', []) # for keypoints augmentation if dataset.use_keypoints: kpt_shape = dataset.data.get('kpt_shape', None) - if flip_idx is None and hyp.fliplr > 0.0: + if len(flip_idx) == 0 and hyp.fliplr > 0.0: hyp.fliplr = 0.0 LOGGER.warning("WARNING ⚠️ No 'flip_idx' array defined in data.yaml, setting augmentation 'fliplr=0.0'") elif flip_idx and (len(flip_idx) != kpt_shape[0]):