-
Notifications
You must be signed in to change notification settings - Fork 468
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
Restore remap boxes #812
Restore remap boxes #812
Conversation
# Conflicts: # tests/tensorflow/test_models_zoo_tf.py
Codecov Report
@@ Coverage Diff @@
## main #812 +/- ##
==========================================
+ Coverage 96.01% 96.10% +0.09%
==========================================
Files 131 131
Lines 4941 4955 +14
==========================================
+ Hits 4744 4762 +18
+ Misses 197 193 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Hi @Rob192, thank you for your PR.
I added a few comments because I am not sure I fully understood the purpose of the remap_boxes function since we moved to a new format of boxes where boxes are described by points and not angles. In any case, can you attach in the issue #800 the image of the document where the boxes are misplaced to help us understanding the bug ? 🙏 Thank you!
orig_height, orig_width = orig_shape | ||
dest_height, dest_width = dest_shape | ||
mboxes = loc_preds.copy() | ||
mboxes[:, :, 0] = ((loc_preds[:, :, 0] * orig_width) + (dest_width - orig_width) / 2) / dest_width |
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.
I am not sure I understand well the computation here: If we have relative coordinates [[x1, y1], [x2, y2], [x3, y3], ...] we just need to multiply by dest_width & dest_height to get the absolute points coordinates in dest_shape referential, or am I missing something ?
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.
Hi @charlesmindee, no you need to take into account the padding that was introduced by rotate_image
. This is the main point of this function remap_boxes
that is here to accommodate these differences.
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.
I added pictures for reference in #800
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.
Ok, thanks I see the point
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 this fix!
orig_height, orig_width = orig_shape | ||
dest_height, dest_width = dest_shape | ||
mboxes = loc_preds.copy() | ||
mboxes[:, :, 0] = ((loc_preds[:, :, 0] * orig_width) + (dest_width - orig_width) / 2) / dest_width |
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.
Ok, thanks I see the point
This PR is to address #800 as part of #788.
It restores the function
remap_boxes
from #488 and adds a new functionality test to verify the output of a pretrained predictor on a rotated document.