-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Adds torchscript Compatibility to box_convert #2737
Changes from 5 commits
1dd9189
6cbdf27
ff8b906
08a3567
605306c
11ab169
169d1bc
fd5c660
f8114c6
3094f03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,25 +167,35 @@ def box_convert(boxes: Tensor, in_fmt: str, out_fmt: str) -> Tensor: | |
boxes_xyxy = _box_xywh_to_xyxy(boxes) | ||
if out_fmt == "cxcywh": | ||
boxes_converted = _box_xyxy_to_cxcywh(boxes_xyxy) | ||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to add tests to improve the coverage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is assert statement before these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, please There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added 👍 |
||
|
||
elif in_fmt == "cxcywh": | ||
boxes_xyxy = _box_cxcywh_to_xyxy(boxes) | ||
if out_fmt == "xywh": | ||
boxes_converted = _box_xyxy_to_xywh(boxes_xyxy) | ||
|
||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
# convert one to xyxy and change either in_fmt or out_fmt to xyxy | ||
else: | ||
if in_fmt == "xyxy": | ||
if out_fmt == "xywh": | ||
boxes_converted = _box_xyxy_to_xywh(boxes) | ||
elif out_fmt == "cxcywh": | ||
boxes_converted = _box_xyxy_to_cxcywh(boxes) | ||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
elif out_fmt == "xyxy": | ||
if in_fmt == "xywh": | ||
boxes_converted = _box_xywh_to_xyxy(boxes) | ||
elif in_fmt == "cxcywh": | ||
boxes_converted = _box_cxcywh_to_xyxy(boxes) | ||
|
||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
else: | ||
raise ValueError("Unsupported Boundig Box Conversions for given in_fmt and out_fmt") | ||
return boxes_converted | ||
|
||
|
||
|
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 was wondering if it would be more simple to check scripted function in all your
test_bbox_*
: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.
Possible, this PR is open for a lot of refactoring 👍 .