-
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
ONNX export of MaskRCNN: dynamic axes seem broken (for batch size > 1) #2311
Comments
cc @neginraoof |
Actually looks like this is a known issue in export of models for batch size > 1, and current tests only cover batch size = 1. cc @fmassa |
Has this been addressed, by any chance? |
Same problem. Is there any plan to support dynamic batch inference now? |
Is there an ETA for support of dynamic batch size > 1 ? |
🐛 Bug
At export to ONNX, dynamic axes were set and the inputs and outputs named properly. However, the output of inferred images is incorrect and wrongly named. Depending on different batch sizes used at export and inference, the behaviour varies as follows:
Supposing that batch size at export time is
n
, and batch size at inference time ism
:n
==m
:Output has length of
n*4
, so ex. ifn=m=3
, output has length of 12. In the onnx runtime session, it looks like in the following screenshot:So only output of the first image in batch is correctly named.
n
<m
:Similar behaviour as in 1., but output for only
n
first images in batch is returned.n
>m
:A "SplitToSequence_XXXX" error is returned, ex. that one:
This exception is similar to behaviour listed in #2309 and seems connected.
To Reproduce
Steps to reproduce the behavior:
1.
Load and export a pretrained MaskRCNN model using
input_tensor
of shape (n, 3, 1024, 1024), for example (4,3,1024,1024):input_tensor
of shape (m,3,1024,1024), wherem
corresponds to the value in the description above, and differentm
values (bigger, smaller or equal ton
) will result in different behaviours.These outputs are presented in the screenshot above.
Expected behavior
With dynamic_axes set properly, I expect:
boxes
,labels
,scores
andmasks
. Also, all outputs correctly named, not like currently in the above screenshot.Environment
Also:
Additional context
This seems connected to #2309 and #2251
The text was updated successfully, but these errors were encountered: