-
-
Notifications
You must be signed in to change notification settings - Fork 11
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 Version #237
Comments
@adoksu Thanks for the question. We are finalizing some changes to HUB that will allow you to set advanced flags for exports. |
At the moment, we cannot use the model in Visual Studio ML.net after
exporting into ONNX since >v15 is not supported.
Do you have any idea to solve it temporarily?
…On Tue, Apr 25, 2023 at 5:13 PM Kalen Michael ***@***.***> wrote:
@adoksu <https://github.com/adoksu> Thanks for the question. We are
finalizing some changes to HUB that will allow you to set advanced flags
for exports.
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB76YRNVGFMCM2DGYGX3XC7SZBANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
@adoksu Yes you can download the pytorch model from HUB and convert it into onnx with the pip install ultralytics from ultralytics import YOLO
# Load a model
model = YOLO('path/to/weights.pt')
# Export the model
model.export(format='onnx', opset=15) You can find the available arguments here: |
How can I do this via ultralytics?
…On Tue, Apr 25, 2023 at 6:37 PM Kalen Michael ***@***.***> wrote:
@adoksu <https://github.com/adoksu> Yes you can download the pytorch
model from HUB and convert it into with the ultralytics package:
from ultralytics import YOLO
# Load a model
model = YOLO('path/to/weights.pt')
# Export the model
model.export(format='onnx', opset=15)
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB7Z6OO5WYSQAYSWB34DXC74S3ANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
how to load the .pt model from my D: drive and export?
Thanks.
…On Tue, Apr 25, 2023 at 6:37 PM Kalen Michael ***@***.***> wrote:
@adoksu <https://github.com/adoksu> Yes you can download the pytorch
model from HUB and convert it into with the ultralytics package:
from ultralytics import YOLO
# Load a model
model = YOLO('path/to/weights.pt')
# Export the model
model.export(format='onnx', opset=15)
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB7Z6OO5WYSQAYSWB34DXC74S3ANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
@adoksu to load a .pt model from your D: drive and export it via ultralytics, you need to provide the full path to the .pt file in the YOLO constructor. You can do this as follows: from ultralytics import YOLO
# Load a model
model = YOLO('D:/path/to/weights.pt')
# Export the model
model.export(format='onnx', opset=15) Note that you need to use forward slashes (/) instead of backward slashes () in the file path. |
@adoksu to load a .pt model from your D: drive and export it via ultralytics, you can provide the full path to the .pt file in the YOLO constructor. Here's an example code snippet: from ultralytics import YOLO
# Load a model
model = YOLO('D:/path/to/weights.pt')
# Export the model
model.export(format='onnx', opset=15) Make sure to use forward slashes (/) instead of backward slashes () in the file path. You can find more information on ultralytics in the official documentation at https://docs.ultralytics.com/. |
I still get the following error. Where is the mistake?
[image: image.png]
…On Tue, Apr 25, 2023 at 8:07 PM Glenn Jocher ***@***.***> wrote:
@adoksu <https://github.com/adoksu> to load a .pt model from your D:
drive and export it via ultralytics, you need to provide the full path to
the .pt file in the YOLO constructor. You can do this as follows:
from ultralytics import YOLO
# Load a modelmodel = YOLO('D:/path/to/weights.pt')
# Export the modelmodel.export(format='onnx', opset=15)
Note that you need to use forward slashes (/) instead of backward slashes
() in the file path.
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB74BALV3A6P5OQAATELXDAHGZANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
@adoksu it seems that the path you provided for the .pt file is incorrect. Double-check the file path and make sure you are providing the correct path to the .pt file on your D: drive. Also, ensure that you are using forward slashes (/) instead of backward slashes () in the file path. |
The path and slash is correct.However, the error still happens.
I call this code as follow under Google Colab. Do you have any
recommendation?
[image: image.png]
…On Tue, Apr 25, 2023 at 11:42 PM Glenn Jocher ***@***.***> wrote:
@adoksu <https://github.com/adoksu> it seems that the path you provided
for the .pt file is incorrect. Double-check the file path and make sure you
are providing the correct path to the .pt file on your D: drive. Also,
ensure that you are using forward slashes (/) instead of backward slashes
() in the file path.
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB77VJ3GK7SGNEHINJZ3XDBANZANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
@adoksu it could be that the issue is related to the differences in file systems between your local machine and Google Colab. Try uploading the .pt file to Google Drive and mounting it in Colab, then access the file using the mounted drive instead of the local file path. Here is an example of how to mount Google Drive in Colab:
You can then access your Google Drive files using the path If the issue persists, please provide more details about the error message you are seeing. |
Dear Glenn,
thank you for the information. If i try from my local D: then i see the
following message. As you slashes are correct:
[image: image.png]
If i try from google drive then it generates the ONNX file with following
messages. Is it correct?
[image: image.png]
…On Wed, Apr 26, 2023 at 1:23 AM Glenn Jocher ***@***.***> wrote:
@adoksu <https://github.com/adoksu> it could be that the issue is related
to the differences in file systems between your local machine and Google
Colab. Try uploading the .pt file to Google Drive and mounting it in Colab,
then access the file using the mounted drive instead of the local file
path. Here is an example of how to mount Google Drive in Colab:
from google.colab import drive
drive.mount('/content/drive')
You can then access your Google Drive files using the path
/content/drive/MyDrive/....
If the issue persists, please provide more details about the error message
you are seeing.
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB77LBIOUE25KWXWBCTLXDBMIRANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
Dear Glenn,
in addition to my previous email:
I achieved to download the model from ultralytics to google drive in .pt
format and converted it to onnx v15 or less. The problem is that converted
onnx model does not run in the .NET C# application (Error:
System.InvalidOperationException: 'Sequence contains no matching element').
If i just download yolov5s in onnx format from ultralytics then it works.
Do you have any idea how we can generate models via ultralytics and use
them in .NET C# application without a problem?
Thanks,
Okan
…On Tue, Apr 25, 2023 at 8:07 PM Glenn Jocher ***@***.***> wrote:
@adoksu <https://github.com/adoksu> to load a .pt model from your D:
drive and export it via ultralytics, you need to provide the full path to
the .pt file in the YOLO constructor. You can do this as follows:
from ultralytics import YOLO
# Load a modelmodel = YOLO('D:/path/to/weights.pt')
# Export the modelmodel.export(format='onnx', opset=15)
Note that you need to use forward slashes (/) instead of backward slashes
() in the file path.
—
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMGUB74BALV3A6P5OQAATELXDAHGZANCNFSM6AAAAAAXLE3BFY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best regards / Mit freundlichen Grüßen
Okan Agbuga
|
@adoksu dear Okan, It's great to hear that you were able to convert the model to ONNX format. Regarding the issue with the .NET C# application, it's possible that the conversion process may have introduced some discrepancies that are not compatible with the .NET ONNX runtime. One suggestion would be to ensure that the ONNX model exported matches the version expected by the .NET application. Additionally, you might want to verify that the input and output tensors are correctly configured and that the preprocessing steps in your .NET application match those expected by the model. If the model downloaded directly from Ultralytics works, you could compare the ONNX versions and operator sets used in both models to identify any differences. Ensuring consistency in these aspects could help resolve the issue. For further assistance, you might also consider reaching out to the .NET community or the maintainers of the ONNX runtime you are using, as they might have more insights into the specific error message you're encountering. |
Search before asking
Question
How to export the model to the ONNX format with the --Opset=15 flag?
Additional
No response
The text was updated successfully, but these errors were encountered: