bump albumentation to >2 and fix breaking changes by arashsm79 · Pull Request #3174 · DeepLabCut/DeepLabCut
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the albumentations dependency from version <=1.4.3 to >=2 and addresses all breaking API changes. The migration includes parameter name changes, method signature updates, and consistent handling of keypoints/bboxes as numpy arrays throughout the codebase.
Changes:
- Updated albumentations dependency to >=2 in setup.py and requirements.txt
- Migrated all deprecated API calls (always_apply → p=1.0, get_params_dependent_on_targets → get_params_dependent_on_data, etc.)
- Changed keypoint and bbox handling to consistently use numpy arrays instead of lists
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated albumentations constraint from <=1.4.3 to >=2 |
| requirements.txt | Updated albumentations constraint from <=1.4.3 to >=2 |
| deeplabcut/pose_estimation_pytorch/data/transforms.py | Comprehensive migration of all albumentations API calls to v2 syntax |
| deeplabcut/pose_estimation_pytorch/data/utils.py | Convert keypoints to numpy array before passing to transforms |
| tests/pose_estimation_pytorch/data/test_transforms.py | Updated keypoint format to use lists (converted to arrays internally) and adjusted precision tolerance |
| tests/pose_estimation_pytorch/other/test_custom_transforms.py | Updated keypoint format to numpy array |
Comments suppressed due to low confidence (2)
deeplabcut/pose_estimation_pytorch/data/transforms.py:485
- The ElasticTransform class still passes the deprecated
always_applyparameter to the parent A.ElasticTransform class. In albumentations v2, this parameter has been removed and should be converted top=1.0 if always_apply else pbefore calling super().init(), similar to other transforms in this file (see Grayscale, CoarseDropout, ScaleToUnitRange examples).
super().__init__(
alpha,
sigma,
alpha_affine,
interpolation,
border_mode,
value,
mask_value,
always_apply,
approximate,
same_dxdy,
p,
)
deeplabcut/pose_estimation_pytorch/data/transforms.py:437
- Empty error message in ValueError. Should provide a descriptive message such as '
alphamust be a float, int, or tuple of two numbers.' to help users understand what went wrong.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.