ultralytics 8.0.107 (#2778)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Peter van Lunteren <contact@pvanlunteren.com>
This commit is contained in:
Glenn Jocher 2023-05-23 13:50:24 +02:00 committed by GitHub
parent 4db686a315
commit dada5b73c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 236 additions and 73 deletions

View file

@ -766,9 +766,17 @@ def v8_transforms(dataset, imgsz, hyp):
pre_transform=LetterBox(new_shape=(imgsz, imgsz)),
)])
flip_idx = dataset.data.get('flip_idx', None) # for keypoints augmentation
if dataset.use_keypoints and flip_idx is None and hyp.fliplr > 0.0:
hyp.fliplr = 0.0
LOGGER.warning("WARNING ⚠️ No `flip_idx` provided while training keypoints, setting augmentation 'fliplr=0.0'")
if dataset.use_keypoints:
kpt_shape = dataset.data.get('kpt_shape', None)
if flip_idx is None 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:
if len(flip_idx) != kpt_shape[0]:
raise ValueError(f'data.yaml flip_idx={flip_idx} length must be equal to kpt_shape[0]={kpt_shape[0]}')
elif flip_idx[0] != 0:
raise ValueError(f'data.yaml flip_idx={flip_idx} must be zero-index (start from 0)')
return Compose([
pre_transform,
MixUp(dataset, pre_transform=pre_transform, p=hyp.mixup),