-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed CenterCropPad incorrectly using fill value for the mask #2195
Fixed CenterCropPad incorrectly using fill value for the mask #2195
Conversation
Reviewer's Guide by SourceryThis PR fixes a bug in the CenterCropPad transformation where the fill value for masks was not being properly applied. The implementation adds a new Class diagram for CenterCropPad changesclassDiagram
class CenterCropPad {
+apply(img, crop_coords, **params)
+apply_to_mask(mask, crop_coords, **params)
+apply_to_bboxes(bboxes, **params)
}
class BaseCrop {
+apply(self, mask, crop_coords, **params)
}
CenterCropPad --|> BaseCrop
note for CenterCropPad "apply_to_mask method added to handle mask padding with correct fill value"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @iRyoka - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
A minimal example to reprodice the addressed problem it: import albumentations as A
import numpy as np
c = A.CenterCrop(
4,
3,
pad_if_needed = True,
fill = 1,
fill_mask = 2
)
out = c(image = np.zeros((1,1,3)), mask = np.zeros((1,1)))
assert 2 in out['mask'], f"Wrong padding: {np.unique(out['mask'])}" |
Thanks, good catch! |
Summary by Sourcery
Fix the issue with CenterCropPad incorrectly using the fill value for the mask and add a corresponding test to ensure correct behavior.
Bug Fixes:
Tests: