-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Update piecewise affine #2010
Update piecewise affine #2010
Conversation
Reviewer's Guide by SourceryThis pull request updates the piecewise affine transformation implementation in the albumentations library. The main changes include replacing the skimage-based implementation with a custom OpenCV-based solution, renaming functions for clarity, and improving the overall efficiency of the transformation process. Class diagram for updated geometric functionsclassDiagram
class GeometricFunctions {
+remap(img: np.ndarray, map_x: np.ndarray, map_y: np.ndarray, interpolation: int, border_mode: int, value: ColorType | None)
+remap_keypoints(keypoints: np.ndarray, map_x: np.ndarray, map_y: np.ndarray, image_shape: tuple[int, int])
+remap_bboxes(bboxes: np.ndarray, map_x: np.ndarray, map_y: np.ndarray, image_shape: tuple[int, int])
+create_piecewise_affine_maps(image_shape: tuple[int, int], grid: tuple[int, int], scale: float, absolute_scale: bool, random_generator: np.random.Generator | None)
}
note for GeometricFunctions "Replaced skimage-based piecewise affine with OpenCV-based remap functions"
Class diagram for PiecewiseAffine transformclassDiagram
class PiecewiseAffine {
-nb_rows: int
-nb_cols: int
-scale: float
-absolute_scale: bool
-cval: float
-mode: str
+apply(img: np.ndarray, map_x: np.ndarray | None, map_y: np.ndarray | None, border_mode: int)
+apply_to_mask(mask: np.ndarray, map_x: np.ndarray | None, map_y: np.ndarray | None, border_mode: int)
+apply_to_bboxes(bboxes: np.ndarray, map_x: np.ndarray | None, map_y: np.ndarray | None, border_mode: int)
+apply_to_keypoints(keypoints: np.ndarray, map_x: np.ndarray | None, map_y: np.ndarray | None, border_mode: int)
+get_params_dependent_on_data(params: dict[str, Any], data: dict[str, Any])
}
note for PiecewiseAffine "Updated to use remap functions instead of skimage's piecewise affine"
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: 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.
Summary by Sourcery
Replace the piecewise affine transformation with a remap-based approach and update related functions and tests.
Enhancements:
Tests: