-
-
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
Add pad if needed3d #2196
Add pad if needed3d #2196
Conversation
Reviewer's Guide by SourceryThis PR introduces support for 3D transforms in the Albumentations library, starting with the PadIfNeeded3D transform. The implementation includes a new base class Transform3D, supporting infrastructure for 3D operations, and comprehensive test coverage. The changes maintain compatibility with existing 2D transforms while adding specialized handling for volumetric data. Class diagram for 3D Transform SupportclassDiagram
class Transform3D {
+apply_to_images(images: np.ndarray, *args, **params) np.ndarray
+apply_to_masks(masks: np.ndarray, *args, **params) np.ndarray
+apply_to_bboxes(bboxes: np.ndarray, **params) np.ndarray
+apply_to_keypoints(keypoints: np.ndarray, **params) np.ndarray
+targets dict[str, Callable[..., Any]]
}
class PadIfNeeded3D {
+min_zyx: tuple[int, int, int] | None
+pad_divisor_zyx: tuple[int, int, int] | None
+position: Literal["center", "random"]
+fill: ColorType
+fill_mask: ColorType
+apply_to_images(images: np.ndarray, padding: tuple[int, int, int, int, int, int], **params) np.ndarray
+apply_to_masks(masks: np.ndarray, padding: tuple[int, int, int, int, int, int], **params) np.ndarray
}
Transform3D <|-- PadIfNeeded3D
class ToTensor3D {
+transpose_mask: bool
+apply_to_images(images: np.ndarray, **params) torch.Tensor
+apply_to_masks(masks: np.ndarray, **params) torch.Tensor
}
Transform3D <|-- ToTensor3D
class ToTensorV2 {
+apply_to_images(images: np.ndarray, **params) torch.Tensor
+apply_to_masks(masks: np.ndarray, **params) torch.Tensor
}
BasicTransform <|-- ToTensorV2
BasicTransform <|-- ToTensor3D
class BasicTransform {
+apply(img: np.ndarray, *args, **params) np.ndarray
}
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 @ternaus - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 3 issues found
- 🟢 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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2196 +/- ##
=========================================
+ Coverage 0 89.61% +89.61%
=========================================
Files 0 50 +50
Lines 0 8603 +8603
=========================================
+ Hits 0 7710 +7710
- Misses 0 893 +893 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
Add support for 3D volumetric data transformations, including PadIfNeeded3D for padding and ToTensor3D for tensor conversion. Enhance the composition module to handle 3D data and update documentation and tests accordingly.
New Features:
Enhancements:
Documentation:
Tests: