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

[Bug]: Fail to read YOLOv8 Pytorch model #24915

Closed
3 tasks done
openvino-book opened this issue Jun 8, 2024 · 1 comment
Closed
3 tasks done

[Bug]: Fail to read YOLOv8 Pytorch model #24915

openvino-book opened this issue Jun 8, 2024 · 1 comment
Assignees
Labels
invalid This doesn't seem right support_request

Comments

@openvino-book
Copy link

OpenVINO Version

2024.1.0-15008-f4afc983258-releases/2024/1

Operating System

Windows System

Device used for inference

CPU

Framework

PyTorch

Model used

yolov8n-cls.pt, yolov8n.pt and yolov8n-seg.pt

Issue description

I learnt OpenVINO 2024.1 can read the Pytorch model: xxx.pt directly as below:
1717814837220

However, I fail to read the yolov8n-cls.pt, yolov8n.pt and yolov8n-seg.pt model using the code as below

import openvino as ov

model_path = r".\yolov8n-cls.pt"

# Read the Pytorch model
print(ov.get_version())
core = ov.Core()

model = core.read_model(model_path)
compiled_model = core.compile_model(model, "CPU")

Error will happen as below, when read yolov8n-cls.pt, yolov8n.pt and yolov8n-seg.pt by read_model()
1717814991363

Step-by-step reproduction

Step 1: set up the environment

pip install openvino ultralytics

Step 2: export yolov8n.pt

yolo export model=yolov8n-cls.pt format=onnx

Step 3: execute the code

import openvino as ov

model_path = r".\yolov8n-cls.pt"

# Read the Pytorch model
print(ov.get_version())
core = ov.Core()

model = core.read_model(model_path)
compiled_model = core.compile_model(model, "CPU")

Relevant log output

No response

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.
@openvino-book openvino-book added bug Something isn't working support_request labels Jun 8, 2024
@andrei-kochin
Copy link
Contributor

Hello @openvino-book,
Thank you for reaching the OpenVINO!

PyTorch native model representation is python so we only support the PyTorch model through the convert_model Python API(See docs).

Also there is a notebook on how to deal with the Yolov8. Check this out here.

Thank you!

@andrei-kochin andrei-kochin self-assigned this Jun 8, 2024
@andrei-kochin andrei-kochin added invalid This doesn't seem right and removed bug Something isn't working labels Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right support_request
Projects
None yet
Development

No branches or pull requests

2 participants