ultralytics 8.3.62 Fix non-deterministic transforms with albumentations>=1.4.21 (#18701)

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Mohammed Yasin 2025-01-16 18:18:19 +08:00 committed by GitHub
parent 5a58950a7c
commit d9292fb7f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -1,6 +1,6 @@
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
__version__ = "8.3.61"
__version__ = "8.3.62"
import os

View file

@ -1860,6 +1860,9 @@ class Albumentations:
if self.contains_spatial
else A.Compose(T)
)
if hasattr(self.transform, "set_random_seed"):
# Required for deterministic transforms in albumentations>=1.4.21
self.transform.set_random_seed(torch.initial_seed())
LOGGER.info(prefix + ", ".join(f"{x}".replace("always_apply=False, ", "") for x in T if x.p))
except ImportError: # package not installed, skip
pass