Skip to content
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 variable batch-size #1030

Closed
daixiangzi opened this issue Apr 9, 2020 · 11 comments
Closed

ONNX export variable batch-size #1030

daixiangzi opened this issue Apr 9, 2020 · 11 comments
Labels
enhancement New feature or request Stale

Comments

@daixiangzi
Copy link

No description provided.

@daixiangzi daixiangzi added the enhancement New feature or request label Apr 9, 2020
@daixiangzi
Copy link
Author

your code only support bs =1,

@daixiangzi
Copy link
Author

i should modify it ,make it suport different batch_szie onnx export

@glenn-jocher
Copy link
Member

glenn-jocher commented Apr 9, 2020

@daixiangzi yes it is hard coded to batch-size 1. If you'd like to submit a PR for multiple batch sizes we can look over it!

One thing to keep in mind is that all of the shapes and constants must be fixed in the model forward pass to prevent onnx errors, so if you make batch size a variable you should probably define it in the model init as a constant rather than using p.shape as in the default forward method.

@glenn-jocher glenn-jocher changed the title when i export different batch size(bs=4 or 8),onnx output is not right? ONNX export variable batch-size Apr 9, 2020
@daixiangzi
Copy link
Author

@daixiangzi yes it is hard coded to batch-size 1. If you'd like to submit a PR for multiple batch sizes we can look over it!

One thing to keep in mind is that all of the shapes and constants must be fixed in the model forward pass to prevent onnx errors, so if you make batch size a variable you should probably define it in the model init as a constant rather than using p.shape as in the default forward method.

yes,Only bs=fixed_number,Not bs,,,_ = p.shape,i have completed multiple batch size

@daixiangzi
Copy link
Author

@daixiangzi yes it is hard coded to batch-size 1. If you'd like to submit a PR for multiple batch sizes we can look over it!

One thing to keep in mind is that all of the shapes and constants must be fixed in the model forward pass to prevent onnx errors, so if you make batch size a variable you should probably define it in the model init as a constant rather than using p.shape as in the default forward method.

i haved submit pr,but it look like failed,i don't konw what's the reason?

@glenn-jocher
Copy link
Member

Ok, I’ll try to take a look tomorrow! Have you exported to onnx successfully using the pr code?

@daixiangzi
Copy link
Author

Ok, I’ll try to take a look tomorrow! Have you exported to onnx successfully using the pr code?

yes,i can export different fixed batch size onnx model,but it appear error,when i try to export dynamic batch model,

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove Stale label or comment or this will be closed in 5 days.

@bing1zhi2
Copy link

bing1zhi2 commented Aug 19, 2020

Ok, I’ll try to take a look tomorrow! Have you exported to onnx successfully using the pr code?

yes,i can export different fixed batch size onnx model,but it appear error,when i try to export dynamic batch model,
@daixiangzi
Thank your for your job....Any update? I'm trying to export a batch size 32 onnx model, but the output node don't have the batch dimension.
微信截图_20200819194145

@luvwinnie
Copy link

any progress on this? I'm trying to export a variable batch size for onnx model, suppose with the dynamic_axes can be dynamic, but it seems like not working.

@glenn-jocher
Copy link
Member

@luvwinnie thanks for your patience! The YOLOv3 model has strict shape requirements for exporting to ONNX, especially for dynamic batch sizes. We’re making progress on adding support for exporting models with dynamic batch sizes and hope to have an update soon. Thank you for your understanding and dedication to improving the YOLOv3 model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale
Projects
None yet
Development

No branches or pull requests

4 participants