-
-
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
Add bboxes to grid shuffle #2057
Conversation
Reviewer's Guide by SourceryThis PR adds support for bounding boxes in the RandomGridShuffle transform by implementing a new bboxes_grid_shuffle function and reorganizing related code. The implementation handles splitting and merging of bounding boxes when they cross tile boundaries, with options to filter based on minimum area and visibility requirements. Class diagram for RandomGridShuffle and related functionsclassDiagram
class RandomGridShuffle {
- grid: tuple[int, int]
- p: float
- always_apply: bool | None
+ apply(img: np.ndarray, tiles: np.ndarray, mapping: list[int], **params: Any) np.ndarray
+ apply_to_bboxes(bboxes: np.ndarray, tiles: np.ndarray, mapping: np.ndarray, **params: Any) np.ndarray
+ apply_to_keypoints(keypoints: np.ndarray, tiles: np.ndarray, mapping: np.ndarray, **params: Any) np.ndarray
+ get_params_dependent_on_data(params: dict[str, Any], data: dict[str, Any]) dict[str, np.ndarray]
+ get_transform_init_args_names() tuple[str, ...]
}
class fgeometric {
+ swap_tiles_on_image(image: np.ndarray, tiles: np.ndarray, mapping: list[int] | None) np.ndarray
+ swap_tiles_on_keypoints(keypoints: np.ndarray, tiles: np.ndarray, mapping: np.ndarray) np.ndarray
+ bboxes_grid_shuffle(bboxes: np.ndarray, tiles: np.ndarray, mapping: list[int], image_shape: tuple[int, int], min_area: float | None, min_visibility: float | None) np.ndarray
+ create_shape_groups(tiles: np.ndarray) dict[tuple[int, int], list[int]]
+ shuffle_tiles_within_shape_groups(shape_groups: dict[tuple[int, int], list[int]], random_generator: np.random.Generator) list[int]
}
RandomGridShuffle --> fgeometric : uses
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: 2 issues found
- 🟡 Complexity: 1 issue found
- 🟢 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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2057 +/- ##
=========================================
+ Coverage 0 90.39% +90.39%
=========================================
Files 0 46 +46
Lines 0 7652 +7652
=========================================
+ Hits 0 6917 +6917
- Misses 0 735 +735 ☔ View full report in Codecov by Sentry. |
Fixes: #1948
Summary by Sourcery
Add support for grid shuffle transformations on bounding boxes and enhance the
RandomGridShuffle
transformation to include bounding boxes as a target. Introduce a new functionbboxes_grid_shuffle
and provide comprehensive tests for its functionality.New Features:
bboxes_grid_shuffle
to apply grid shuffle transformations to bounding boxes, allowing for more flexible data augmentation.Enhancements:
RandomGridShuffle
transformation to include bounding boxes as a target, enhancing its functionality.Tests:
bboxes_grid_shuffle
function, covering various scenarios including basic functionality, minimum area and visibility filters, and handling of extra fields.