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

convert to openvino #697

Closed
linhaoqi027 opened this issue Aug 10, 2020 · 15 comments · Fixed by #6057
Closed

convert to openvino #697

linhaoqi027 opened this issue Aug 10, 2020 · 15 comments · Fixed by #6057
Labels
question Further information is requested Stale Stale and schedule for closing soon

Comments

@linhaoqi027
Copy link

❔Question

hi! I want to convert yolov5s to openvino. First it will convert to onnx, it is no problem, ans then when i convert onnx to openvino. It occurs problem.

Additional context

捕获

@linhaoqi027 linhaoqi027 added the question Further information is requested label Aug 10, 2020
@glenn-jocher
Copy link
Member

glenn-jocher commented Aug 10, 2020

Sorry buddy, can't help, no experience. If you get this to work it might be useful to write a tutorial that we could add to https://docs.ultralytics.com/yolov5 to help others.

@Aktcob
Copy link

Aktcob commented Aug 12, 2020

ha, I am faced with the same problem.

A possible way is that, the node 'Upsampling' with nearest mode can be converted to 'Upsampling' op(in ONNX) not the 'resize' op. It seemed that there is bug when 'resize' op in ONNX--->'interpolate' op in OPENVINO. And the Upsampling op in ONNX is ok.

Another way is that do not use the Upsampling op in Pytorch. You can copy the value like https://github.com/dmlc/gluon-cv/blob/master/gluoncv/model_zoo/yolo/yolo3.py#L31

@linhaoqi027
Copy link
Author

I update the openvino to 2020R4, it is solved

@anhnktp
Copy link

anhnktp commented Aug 19, 2020

@linhaoqi027 which opset value you used in converting to onnx. I'm facing the issues when convert yolov5 .pth model to openvino with opset = 10 (can't convert full the model). If I use opset = 11 or 12, I can conver full model to onnx but meet error resize operator only support for opset = 10 in openvino 2020R4.
Could you pls give your script convert to openvino ?

@linhaoqi027
Copy link
Author

opset=10

@linhaoqi027
Copy link
Author

I can convert to openvino

@anhnktp
Copy link

anhnktp commented Aug 21, 2020

@linhaoqi027 thanks. I also use opset = 10 now, but I have trouble on final result after converting openvino model. I can output 3 features map from converted model and then apply some numpy calculation & nms step to output bounding bo (followed #343 ) . But its seems NMS step doesn't working. Could you share your script to inference of converted openvino model ? if possile, could you give me your contact ? Thank you in advance !!!
image

@samirMeziane
Copy link

@anhnktp can you tell me please if you have output with 5d shape like 1x80x80x3x7 cause i have an error when i run my transformed yolov5 openvino (outlayer ie::layout::NCDHW || outlayer ie::layout::NDHWC)

@linhaoqi027
Copy link
Author

@linhaoqi027 thanks. I also use opset = 10 now, but I have trouble on final result after converting openvino model. I can output 3 features map from converted model and then apply some numpy calculation & nms step to output bounding bo (followed #343 ) . But its seems NMS step doesn't working. Could you share your script to inference of converted openvino model ? if possile, could you give me your contact ? Thank you in advance !!!
image

ok,[email protected].

@linhaoqi027
Copy link
Author

@anhnktp can you tell me please if you have output with 5d shape like 1x80x80x3x7 cause i have an error when i run my transformed yolov5 openvino (outlayer ie::layout::NCDHW || outlayer ie::layout::NDHWC)

I can't known the reason without debug.But u can transform output to tensor then apply nms in this project.It works.

@samirMeziane
Copy link

thanks for your reply , my question was that i transformed onnx to xml format but when i try to do inference in openvino i get errors can you please tell me what wrong in my xml file
openvio(1).zip

@linhaoqi027
Copy link
Author

thanks for your reply , my question was that i transformed onnx to xml format but when i try to do inference in openvino i get errors can you please tell me what wrong in my xml file
openvio(1).zip
Oh I will upload my project soon, and you can read my code directly soon. Sorry I dont have enough time to debug your code.

@linhaoqi027
Copy link
Author

感谢您的答复,我的问题是我将onnx转换为xml格式,但是当我尝试在openvino中进行推断时遇到错误,您能告诉我xml文件
openvio(1).zip中有什么问题吗,
哦,我将上传我的项目很快,您可以很快直接阅读我的代码。抱歉,我没有足够的时间来调试您的代码。

you can following #891 to start

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Oct 2, 2020
@github-actions github-actions bot closed this as completed Oct 7, 2020
@glenn-jocher glenn-jocher linked a pull request Dec 23, 2021 that will close this issue
@glenn-jocher
Copy link
Member

glenn-jocher commented Dec 23, 2021

@linhaoqi027 @anhnktp @samirMeziane @Aktcob good news 😃! Your original issue may now be fixed ✅ in PR #6057. This PR adds native YOLOv5 OpenVINO export:

python export.py --weights yolov5s.pt --include openvino  # export to OpenVINO

image

To receive this update:

  • Gitgit pull from within your yolov5/ directory or git clone https://github.com/ultralytics/yolov5 again
  • PyTorch Hub – Force-reload model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
  • Notebooks – View updated notebooks Open In Colab Open In Kaggle
  • Dockersudo docker pull ultralytics/yolov5:latest to update your image Docker Pulls

Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale Stale and schedule for closing soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants