Relax Albumentations requirement to support 2.x#786
Relax Albumentations requirement to support 2.x#786
Conversation
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #786 +/- ##
=======================================
- Coverage 73% 66% -7%
=======================================
Files 69 69
Lines 8149 8184 +35
=======================================
- Hits 5965 5391 -574
- Misses 2184 2793 +609 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR expands RF-DETR’s Albumentations compatibility to include 2.x by relaxing the dependency constraint and normalizing RandomSizedCrop configuration arguments so the same RF-DETR aug config works across Albumentations 1.x and 2.x.
Changes:
- Relax Albumentations version constraint to allow 2.x.
- Normalize
RandomSizedCropparams at transform construction time to bridgeheight/width(1.x) vssize=(h, w)(2.x). - Add unit tests for both constructor variants and update augmentation docs to reflect supported versions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/rfdetr/datasets/transforms.py |
Normalize RandomSizedCrop params based on the installed Albumentations API signature. |
tests/datasets/test_augmentations.py |
Adds targeted tests for the parameter normalization behavior via monkeypatched RandomSizedCrop. |
pyproject.toml |
Relaxes Albumentations upper bound to <3.0.0. |
docs/learn/train/augmentations.md |
Documents Albumentations 1.4.24+ and 2.x support. |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
Applied the remaining review-thread change in af0112f: the Albumentations dependency floor is now aligned with the documented support range at |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Borda <6035284+Borda@users.noreply.github.com>
… for PR #786 - Add TestRandomSizedCropCompat with 6 new tests: - ValueError raised for height-without-width (and vice versa) on 2.x API - height/width silently dropped when size is also provided on 2.x API - scalar size passes through unchanged on v1 legacy path - Add comment on unreachable legacy branch (uses_size=False) explaining it cannot trigger with albumentations>=1.4.24 - Add troubleshooting note in augmentations.md for height/width auto-adaptation - Add CHANGELOG entry for version relaxation (>=1.0.0,<2.0.0 → >=1.4.24,<3.0.0) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
You can also share your feedback on Copilot code review. Take the survey.
| # NOTE: This branch is unreachable when albumentations>=1.4.24 is installed | ||
| # (the package constraint since PR #786). albumentations 1.4.24 introduced | ||
| # ``size`` to RandomSizedCrop, so _random_sized_crop_uses_size_param() always | ||
| # returns True for any conformant installation. The code is kept for | ||
| # completeness and is covered only by tests using synthetic fake classes. |
There was a problem hiding this comment.
The NOTE here claims the non-uses_size branch is unreachable for albumentations>=1.4.24, but this file/docstrings (and the new tests) explicitly support a 1.x height/width API path. This comment looks inconsistent with the intended cross-version behavior and could mislead future maintainers; please update or remove it to reflect the actual supported signatures (and/or explain precisely which versions have which signature).
| # NOTE: This branch is unreachable when albumentations>=1.4.24 is installed | |
| # (the package constraint since PR #786). albumentations 1.4.24 introduced | |
| # ``size`` to RandomSizedCrop, so _random_sized_crop_uses_size_param() always | |
| # returns True for any conformant installation. The code is kept for | |
| # completeness and is covered only by tests using synthetic fake classes. | |
| # NOTE: | |
| # For the official Albumentations ``RandomSizedCrop`` implementation on | |
| # versions >=1.4.24 (the minimum constrained in this project), the transform | |
| # accepts a ``size`` parameter, so ``_random_sized_crop_uses_size_param()`` | |
| # will return True and this ``not uses_size`` branch will not be taken. | |
| # However, this function is intentionally written to also support | |
| # 1.x-style APIs that use ``height``/``width`` (e.g. older Albumentations | |
| # versions, custom transforms, or synthetic classes used in tests). In those | |
| # cases ``uses_size`` can be False and this branch performs the inverse | |
| # normalization from ``size`` -> (height, width). |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
_normalize_albu_paramsto compute the Albumentations API shape once and keep behavior unchangedOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.