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

[docs] yolort and yolov5 version matching problem #377

Open
zhiqwang opened this issue Apr 7, 2022 · 5 comments
Open

[docs] yolort and yolov5 version matching problem #377

zhiqwang opened this issue Apr 7, 2022 · 5 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@zhiqwang
Copy link
Owner

zhiqwang commented Apr 7, 2022

I used following commad to export the ONNX models, and I use the 5.0 tag of ultralytics/yolov5 to train the model.pt. It raises an AttributeError: conv object has no attribute weight. How can I do for this error?

python tools/export_model.py --checkpoint_path model.pt --size_divisible 32

Originally posted by @Deronjey in #159 (comment)

@zhiqwang zhiqwang added the documentation Improvements or additions to documentation label Apr 7, 2022
@zhiqwang
Copy link
Owner Author

zhiqwang commented Apr 7, 2022

We support version 3.1, 4.0 and 6.0 released by ultralytics/yolov5. And actually the version 5.0 models released by yolov5 is same with 4.0, so we can just set upstream_version="r4.0" if we're using the 5.0. Similarly the model structure in tag 6.1 is same with 6.0, so we can set the upstream_version to "r6.0" if our model is trained with 6.1.

We have also added the function of matching versions to CLI tool export_model.py as well. We can add the argument --version r4.0 to this CLI tool.

python3 tools/export_model.py --checkpoint_path model.pt --size_divisible 32 --version r4.0

Maybe we should add this tips at the docs, and contributions are welcome here.

@zhiqwang zhiqwang added the good first issue Good for newcomers label Apr 7, 2022
@Deronjey
Copy link

Hi @zhiqwang
Firstly, i'm sincerely appreciate you to help me.
and i have saved my onnx by yolov5-rt-stack,however,when i open the onnx by netron,i find there are some subgraph and some node like "if" 'where',it's unfriendly for me to deploy.so what can i do for this?

@zhiqwang
Copy link
Owner Author

Hi @Deronjey , Which platform do you want to deploy to currently?

@Deronjey
Copy link

baidu kunlun K100

@zhiqwang
Copy link
Owner Author

zhiqwang commented Apr 11, 2022

Hi @Deronjey , you can try the following scripts to export the ONNX models:

from yolort.relay.trt_graphsurgeon import YOLOTRTGraphSurgeon

checkpoint_path = "yolov5s.pt"
yolo_gs = YOLOTRTGraphSurgeon(checkpoint_path, enable_dynamic=False)
onnx_export_path = "yolov5s_wo_nms.onnx"

yolo_gs.save(onnx_export_path)

And seems that we should install onnx-graphsurgeon first:

python3 -m pip install onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants