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

Support skipping preprocess when exporting ONNX #193

Merged
merged 5 commits into from
Oct 7, 2021

Conversation

zhiqwang
Copy link
Owner

@zhiqwang zhiqwang commented Oct 7, 2021

Using the following snippet will export a dynamic batch/shape ONNX model without pre-processing (aka letterbox in YOLOv5 and NestedTensor in yolort).

# 'yolov5s.pt' is downloaded from https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5s.pt
python tools/export_model.py --checkpoint_path yolov5s.pt --skip_preprocess

https://github.com/zhiqwang/yolov5-rt-stack/blob/6cb22845a41bf4dd846a9bcad06c09d3fec8cd49/yolort/models/transform.py#L217-L251

Meanwhile we require the shape of the inputs to be Nx3xHxW, and as such this will close #39, close #45 and close #159.

@zhiqwang zhiqwang added the enhancement New feature or request label Oct 7, 2021
@codecov
Copy link

codecov bot commented Oct 7, 2021

Codecov Report

Merging #193 (5421eea) into master (6cb2284) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #193   +/-   ##
=======================================
  Coverage   96.48%   96.49%           
=======================================
  Files          10       10           
  Lines         598      599    +1     
=======================================
+ Hits          577      578    +1     
  Misses         21       21           
Flag Coverage Δ
unittests 96.49% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
test/test_utils.py 98.41% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6cb2284...5421eea. Read the comment docs.

@zhiqwang zhiqwang merged commit d1f02f6 into master Oct 7, 2021
@zhiqwang zhiqwang deleted the support-skip-preprocess branch October 7, 2021 16:56
@zhiqwang zhiqwang added the API Library use interface label Oct 14, 2021
@zhiqwang zhiqwang mentioned this pull request Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Library use interface enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

yolov5 to onnx model with nms Support dynamic batch inference with onnx/onnxruntime Add a batch dimension
1 participant