Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6555 Discussions

YoloV10 model .xml is not a supported model format

RGVGreatCoder
Novice
1,465 Views

I am getting the error message "model... .xml is not a supported model format" when it executes this python code: "results=model(imageFrame, conf=0.2)".

I am trying to run inference on an OpenVINO exported model with Ultralytics API following this page: https://docs.openvino.ai/2024/notebooks/yolov10-optimization-with-output.html 

This is part of my python program:

 

import cv2
from ultralytics import YOLO

pt_model = pt_model_path + 'best.pt'
onnx_model = onnx_model_path + 'best.onnx'
ov_model = openvino_model_path + 'best.xml'

model = YOLO(ov_model, task="detect") # <-- WORKS WELL WITH ALL MODELS

cap = cv2.VideoCapture(video_file)
...
while...
  imageFrame = cap.read()
  ...
  results=model(imageFrame, conf=0.2) # <-- ERROR WHEN USING OPENVINO MODEL
  ...
  annotated_frame = results[0].plot() # Visualize the results on the frame
  cv2.imshow("Y10 inference", annotated_frame)
  if cv2.waitKey(1) & 0xFF == ord('q'):
    break

cap.release()
cv2.destroyAllWindows()

 

I am using a Windows 11 machine with CUDA (NVIDIA RTX 4060) and, I have to believe I am using YoloV10 because somehow, I understand it is now integrated in Ultralytics. These are the steps I performed:

  • Installed Python 3.10.4 globally (I uninstalled all other versions globally first)
  • Created (and then activated) the python virtual environment "y_env" where I ran the following "pip" commands:

 

> pip install ultralytics # Gets me version 8.2.58
# I downloaded the requirements.txt file from https://github.com/THU-MIG/yolov10/tree/main
> pip install -r requirements.txt
> pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

 

  • I created the custom model by training with "yoloV10n.pt" using my GPU (it took nearly two minutes to finish) as follows:

 

> yolo task=detect mode=train model=yolov10n.pt data=<path>\data.yaml epochs=100 imgsz=416 plots=True device=0

 

  • When finished training, I first tested my python program with the [<path>\runs\detect\train9\weights\best.pt] PyTorch file and it worked well displaying the images with bounding boxes.
  • I then exported the PyTorch file to ONNX and OpenVINO formats as follows:

 

> yolo export model=<path>\runs\detect\train9\weights\best.pt format=openvino
> yolo export model=<path>\runs\detect\train9\weights\best.pt format=onnx

 

  • I tested my python program with the [<path>\runs\detect\train9\weights\best.onnx] ONNX file and it worked well displaying the images with bounding boxes.

I also got the same error after performing the above steps with the "YoloV10" that I cloned from these two GitHub links:

  1. https://github.com/THU-MIG/yolov10.git  (which gives Ultralytics 8.1.34)
  2. https://github.com/ultralytics/ultralytics.git@main  (which gives Ultralytics 8.2.58).

Questions:

  1. Why am I getting the "model... .xml is not a supported model format" error when running the program with the XML OpenVINO model?
  2. If you find me a solution to this problem, could you please detail me all the steps I need to fix it? I will really appreciate it.

Thank you in advance and eagerly waiting for your reply,

Manuel Hernandez

 

 

0 Kudos
2 Replies
Iffa_Intel
Moderator
1,389 Views

Hi,

 

from my side, I don't have any issue in inferencing YOLOv10 by following this guide.

Please note that OpenVINO is meant to be used with Intel hardwares.

If all the conditions required are fulfilled, you should be able to infer OpenVINO with YOLOv10 model.

 

1_yolo10.JPG

2_yolo10.JPG

 

Cordially,

Iffa

0 Kudos
Iffa_Intel
Moderator
1,250 Views

Hi,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question. 


Cordially,

Iffa


0 Kudos
Reply