-
Notifications
You must be signed in to change notification settings - Fork 330
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
feat: Add minimum_box_area_ratio
to filter out poor, partial boxes
#2484
base: master
Are you sure you want to change the base?
feat: Add minimum_box_area_ratio
to filter out poor, partial boxes
#2484
Conversation
@@ -103,6 +103,7 @@ def __init__( | |||
crop_size=None, | |||
bounding_box_format=None, | |||
interpolation="bilinear", | |||
minimum_box_area_ratio=0.0, |
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.
let us remove this from the augmentation layers. We need to keep this consistent with the other layers. Let us not touch this.
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.
Thanks for the PR! Left a few comments!
@@ -23,6 +23,7 @@ def main(): | |||
target_size=(512, 512), | |||
scale_factor=(3 / 4, 4 / 3), | |||
bounding_box_format="xyxy", | |||
minimum_box_area_ratio=0.5 |
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.
remove this as well. Maybe add a doc string to clip_to_image
, explain the args and add an example there
clipped_bounding_boxes = bounding_box.convert_format( | ||
clipped_bounding_boxes, | ||
source="rel_xyxy", | ||
target=bounding_box_format, | ||
images=images, | ||
image_shape=image_shape, | ||
) | ||
passed = ops.logical_and(areas > 0.0, area_ratios > minimum_box_area_ratio) |
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.
can we rename passed to something more meaningful - valid_box
maybe?
What does this PR do?
This PR adds logic to the
bounding_box.clip_to_image
to 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.