This repository was archived by the owner on Mar 10, 2026. It is now read-only.
feat: Add minimum_box_area_ratio to filter out poor, partial boxes#2484
Open
thomas-coldwell wants to merge 2 commits intokeras-team:masterfrom
Open
feat: Add minimum_box_area_ratio to filter out poor, partial boxes#2484thomas-coldwell wants to merge 2 commits intokeras-team:masterfrom
minimum_box_area_ratio to filter out poor, partial boxes#2484thomas-coldwell wants to merge 2 commits intokeras-team:masterfrom
Conversation
kennyweigel
approved these changes
Aug 29, 2024
| crop_size=None, | ||
| bounding_box_format=None, | ||
| interpolation="bilinear", | ||
| minimum_box_area_ratio=0.0, |
Collaborator
There was a problem hiding this comment.
let us remove this from the augmentation layers. We need to keep this consistent with the other layers. Let us not touch this.
divyashreepathihalli
suggested changes
Sep 3, 2024
Collaborator
divyashreepathihalli
left a comment
There was a problem hiding this comment.
Thanks for the PR! Left a few comments!
| target_size=(512, 512), | ||
| scale_factor=(3 / 4, 4 / 3), | ||
| bounding_box_format="xyxy", | ||
| minimum_box_area_ratio=0.5 |
Collaborator
There was a problem hiding this comment.
remove this as well. Maybe add a doc string to clip_to_image, explain the args and add an example there
| images=images, | ||
| image_shape=image_shape, | ||
| ) | ||
| passed = ops.logical_and(areas > 0.0, area_ratios > minimum_box_area_ratio) |
Collaborator
There was a problem hiding this comment.
can we rename passed to something more meaningful - valid_box maybe?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds logic to the
bounding_box.clip_to_imageto attenuate the boxes that fall below a certain threshold of their original area in an image. This is particularly useful when creating a training dataset and wanting to ensure partial elements of an object that could now belong to any class e.g. a foot are not detected as a particular class leading to a noisy output during inference.This can be tested with the jittered resize demo by setting this value to 0.95 (most boxes will be filtered out as at least 5% has been cropped / clipped out) and then setting it to 0.0 which will make it behave as before.
@divyashreepathihalli and @sampathweb
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.