fix: ensure augmentation reproducibility with Albumentations RNG#5
fix: ensure augmentation reproducibility with Albumentations RNG#5
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ea5e588f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| def __init__(self, transform: A.Compose, p: float = 1.0): | ||
| """Store wrapped transform and application probability. | ||
| def __init__(self, transform: A.Compose): |
There was a problem hiding this comment.
Preserve
p argument for Albumentations adapter
Removing the p parameter from Albumentations.__init__ is a backward-incompatible API change: any existing training code that instantiated this wrapper as Albumentations(transform, p=...) will now raise TypeError before augmentation runs. Since this class previously documented and accepted p, keep the argument (even if deprecated and internally forwarded to compose-level probability) to avoid breaking downstream pipelines on upgrade.
Useful? React with 👍 / 👎.
Summary
Align custom augmentation randomness with Albumentations-managed RNG so runs can be reproduced via
Compose(seed=...).Changes
ShadesOfGrayrandom sampling intoget_params()usingself.random_generatorShadesOfGray.apply()to consume sampledp_norminstead of reading global NumPy RNGultralytics.Albumentationsand delegated probability control to Albumentations transformsCompose(seed=...)Testing
make formatmake lintmake testuv run pytest tests/albumentations/test_transforms.pyChecklist
docs/.feat: ...,fix: ...).