-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Lahaidar/export faster rcnn #1401
Conversation
…idar/export_faster_rcnn
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.
Changes are pretty minimal, that's pretty nice, thanks for the PR @lara-hdr !
I have a few comments and questions, let me know if I'm missing something
…idar/export_faster_rcnn
@lara-hdr can you rebase your PR on top of master? I've issued a fix to CI that should make things work. Also, I've (temporarily) made torchvision CI depend on PyTorch 1.3, so maybe we might need to disable a few tests if the PyTorch version is not greater than 1.4 (like |
Codecov Report
@@ Coverage Diff @@
## master #1401 +/- ##
==========================================
- Coverage 64.46% 63.29% -1.17%
==========================================
Files 83 83
Lines 6421 6424 +3
Branches 982 880 -102
==========================================
- Hits 4139 4066 -73
- Misses 1992 2047 +55
- Partials 290 311 +21
Continue to review full report at Codecov.
|
@fmassa the roi_heads test also calls transform.postprocess() at the end, so it uses the unbind. |
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.
@lara-hdr we will be moving CI back to PyTorch nightly, so we can remove the tests being disabled in a follow-up PR.
Thanks a lot for the PR!
pred_scores = pred_scores.split(boxes_per_image, 0) | ||
if len(boxes_per_image) == 1: | ||
# TODO : remove this when ONNX support dynamic split sizes | ||
pred_boxes = (pred_boxes,) |
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.
What is the limitation here exactly?
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 think that ONNX exporter doesn't yet support a boxes_per_image
which is dynamic, so it gets converted into a constant and thus doesn't work for different number of boxes.
This is something that will be fixed by the ONNX team I believe, and this is currently only a workaround solution (which I think shouldn't affect torchscript?)
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.
exactly. split is not yet supported with dynamic sizes (so boxes_per_image will be exported as a constant which will for with any new input). But we are working on supporting this scenario in the exporter
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.
If the length isn't 1 isn't it still dynamic ? Not getting how this isn't still dynamic.
(small change to support in TS, mostly just curious)
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.
it is, but we are currently only supporting a batch size of 1
In addition to #1329 and #1329, these are the last changes to be able to export faster rcnn to ONNX.
For now we will only be able to export with a batch of 1 (split in ONNX is static, but we are working on supporting dynamic cases that will allow us to export postprocess_detections in roi_heads with a batch_size > 1).
The test is disabled for now, until the 2 references PRs are merged and bilinear Resize is implemented in opset 11 to match PyTorch's interpolate.