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

Add CLI tool for exporting ONNX models #175

Merged
merged 7 commits into from
Sep 28, 2021

Conversation

runrunrun1994
Copy link
Contributor

Signed-off-by: runrunrun1994 runrunrun1994@163.com

@CLAassistant
Copy link

CLAassistant commented Sep 25, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Sep 25, 2021

Codecov Report

Merging #175 (096e511) into master (dce0263) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #175   +/-   ##
=======================================
  Coverage   96.16%   96.16%           
=======================================
  Files          10       10           
  Lines         600      600           
=======================================
  Hits          577      577           
  Misses         23       23           
Flag Coverage Δ
unittests 96.16% <ø> (ø)

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


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 dce0263...096e511. Read the comment docs.

@zhiqwang zhiqwang changed the title add export onnx cli code Add CLI tool for exporting ONNX models Sep 25, 2021
@zhiqwang zhiqwang added the enhancement New feature or request label Sep 25, 2021
@itsnine
Copy link
Contributor

itsnine commented Sep 25, 2021

@zhiqwang @runrunrun1994 hello, it probably would be good if you add a feature for exporting onnx custom models, not only pretrained on coco dataset. I guess you should add something like torch.load_state_dict. What do you think?

@zhiqwang
Copy link
Owner

zhiqwang commented Sep 26, 2021

@zhiqwang @runrunrun1994 hello, it probably would be good if you add a feature for exporting onnx custom models, not only pretrained on coco dataset. I guess you should add something like torch.load_state_dict. What do you think?

Hi @itsnine @runrunrun1994 , This proposal is very good, because the trainer of yolort is still in the experimental stage, we have recently added a new interface to directly load yolov5 trained models #167, we can use this interface to implement this feature you mentioned.

from yolort.models import yolov5s

# the following 'yolov5s.pt' is downloaded from https://github.com/ultralytics/yolov5/releases/download/v4.0/yolov5s.pt
args.checkpoint_path = 'yolov5s.pt'
model = yolov5s(num_classes=args.num_classes, score_thresh=args.score_thresh, ...)
model.load_from_yolov5(args.checkpoint_path)
model.eval()

img_path = 'test/assets/bus.jpg'
results = model.predict(img_path)

tools/export_onnx.py Outdated Show resolved Hide resolved
tools/export_onnx.py Outdated Show resolved Hide resolved
Copy link
Owner

@zhiqwang zhiqwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @runrunrun1994 , Thanks for your contributions here. I left some comments, let me know your thoughts about these.

tools/export_onnx.py Outdated Show resolved Hide resolved
tools/export_onnx.py Outdated Show resolved Hide resolved
tools/export_onnx.py Outdated Show resolved Hide resolved
Signed-off-by: runrunrun1994 <runrunrun1994@163.com>
Signed-off-by: runrunrun1994 <runrunrun1994@163.com>
Signed-off-by: runrunrun1994 <runrunrun1994@163.com>
Signed-off-by: runrunrun1994 <runrunrun1994@163.com>
@zhiqwang zhiqwang merged commit 750e3b4 into zhiqwang:master Sep 28, 2021
@zhiqwang zhiqwang added the API Library use interface label Oct 14, 2021
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.

None yet

4 participants