-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
How to run yolov8 on OpenVino? #191
Comments
Thanks I run yolov8n int8 IR converted model using this notebook, it consume 40% of my CPU on 10 FPS live stream. But if I restrict thread using taskset command it consume only 8-10% CPU on the same stream. So, why it is required to restrict CPU and how I can fix this? |
@yury-gorbachev, any idea who can help with that? |
@dmitry-gorokhov or @wangleis can you guys look at this question? |
@dhaval-zala-aivid @dhaval-zala Could you please share the full command which restrict thread using taskset command? |
@dhaval-zala-aivid @dhaval-zala Could you please share log of |
@dhaval-zala-aivid @dhaval-zala OpenVINO uses all CPU resources provided for application for inference. But when there is not enough input, the CPU will idle. yolo_openvino_demo.py you used loaded network to OpenVINO with 2 infer request. The following benchmark app command also loads network to OpenVINO with 2 infer request. Run this command with yolov8n int8 IR converted by 230-yolov8-optimization.ipynb on 4 cores 8 CPUs platform, the throughput performance is 20.31 FPS.
If run benchmark app in throughput mode as below comments, the throughput performance can achieve 30.04 FPS.
So 10 FPS live stream cannot provide enough inputs in you case. Please try the two benchmark app commands, all CPU resource on you platform will be used. |
I have tried this notebook for inference my model, but I'm recieving error: 2 frames RuntimeError: Trying to create tensor with negative dimension -73: [0, -73]` |
@HENNESSYxie if I correctly understand, does your model trained on a different dataset? there is a parameter inside detect function, when calling non_maximum_suppression, nc - it is responsible for a number of classes known by the model, please try to modify it according to your model supported a number of classes |
Its worked for me. Thanks! |
@wangleis @adrianboguszewski is there any simple script to run yolov8 openvino model?
i just want to use openvino weights insted of yolov8.pt , its possible to get that script ? something like
|
I see. We don't have a simple script for that, but you can look here for the simpler solution. |
@akashAD98 you don't need any external notebook or custom script to run OpenVINO models, you run them with the CLIyolo predict model=yolov8n_openvino_model/
yolo predict model=yolov8n.onnx
yolo predict model=yolov8n.engine
# ... etc. Pythonfrom ultraltyics import YOLO
model = YOLO('yolov8n_openvino_model/')
results = model(img) See https://docs.ultralytics.com/modes/export for details |
i tested with tracker & this is the speed im getting, ill try yolov8s_int format for getting more fps.
|
@akashAD98 OpenVINO should show speedups on Intel CPUs, i.e. if you look at the CI benchmarks here. On other CPUs ONNX may be faster: |
@glenn-jocher its fp32 openvino model or int8.xml model? |
@glenn-jocher when i didi the fps check this is how im getting, i tried it on 16 core macine & yolov8s.pt has higher fps than openvino yolov8s.xml file, may i know why its like this? |
@akashAD98 It's curious that you are getting better results with Regarding your second question, most YOLO models do not require input images that are multiples of 32, but instead accept any image size that is divisible by two. |
@adrianboguszewski is there any way to improve fps using yolo code & openvino weights? like passing the number of threads , asynchronous queue or any other methods which we can integrate with current Yolo code? |
Yes. We created a new notebook showing how to improve the performance in OpenVINO. It hasn't been merged yet, but you can see some tricks here |
@akashAD98 Yes, there are several ways to improve the performance of OpenVINO models. One of them is to use number of threads, i.e. you can try to set the |
@glenn-jocher i want to add this code , is there nay way to customise yolo code?
below are the some improvment things i want to try
|
@akashAD98 Yes, you can customize the YOLO code to add features such as setting the number of threads or tuning other parameters. One way to do this is to modify the YOLO code directly and add functions that allow you to do this customization, or you could create a new class that inherits from the YOLO class and add the new features there. Just be careful when you modify the code, because it might affect other parts of the YOLO codebase. The safer way to add these features is by creating a wrapper function that loads the OpenVINO model and then sets the desired parameters before calling the YOLO function with the loaded model. |
@glenn-jocher i was using int8_format of openvino weight . i compaired fps it with yolov8_openvino weight & im exactly getting same fps, is also in the export of openvino model there is metadata.yaml file is generating |
@akashAD98 The |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
@achuntelolan you're welcome! If you have any more questions or need further assistance, feel free to ask. Happy coding! 😊 |
Hi is Yolo v8 openvino model will work with openvio version 2022 and below and Python 3.6? because my current project is running on this configuration that's why, can anyone please help me? |
@achuntelolan hello! 👋 YOLOv8 models exported for OpenVINO should be compatible with OpenVINO 2022 versions and work fine with Python 3.6. However, it's always good to test with your specific setup. If you encounter any issues, make sure to have the latest version of the YOLOv8 repository and consider updating OpenVINO if possible. Here's a quick snippet on how to load and use the model: from openvino.runtime import Core
core = Core()
model = core.read_model(model="path/to/your/model.xml")
compiled_model = core.compile_model(model=model, device_name="CPU")
# Now you're ready to make predictions with `compiled_model`! If you run into any specific errors, feel free to share them here! 😊 |
hii @glenn-jocher while i trying to load the openvino model of yolov8 I am getting error like this I am using open vino 2021 version: |
@achuntelolan OV 2021 is a very old version. Any chance to update it to something newer? I think it may resolve your issue. |
Hii @adrianboguszewski updating to a newer version is a little difficult because I am running this project individually in 88 systems that are in different locations in India so updating the version is the last way before we try to resolve using the older version |
Could you report your bug here: https://github.com/openvinotoolkit/openvino/issues? I think our developers will be able to help :) |
Hii when i trying to run yolo v8 on openvino version 2022.2.0 with python 3.6 getting this error: |
Did you convert the model to OV with 2022.2 as well? The best way is to convert the model with the version you want to use for inference |
how i can ? |
Have you tried this?
|
This is just exporting the pytorch model to the openvino model right, this I have done I need how to convert to the openvino 2022 version supported model |
You just need to run the code above, when you have OpenVINO 2022 installed. |
Absolutely! Once you have OpenVINO 2022 installed, running the code provided will export your YOLOv8 model in a format compatible with OpenVINO 2022. This ensures that the model utilizes the latest optimizations and features available in the newer version of OpenVINO. If you encounter any issues during the process, feel free to reach out! 😊 |
ya ok, but I am using python3.6 with openvino 2022.2.0 version, here while I trying to install Ultralytics lib it gives the following error : while I'm trying to install the ultralytics package using pip in the python3.6 version it's not getting installed its showing this error: Installing collected packages: openvino-telemetry, openvino |
I believe you need to use a newer version of Ultralytics as well. Then newer OpenVINO will be installed. |
You're right! Upgrading to a newer version of Ultralytics can help ensure compatibility with the latest OpenVINO. You can update the Ultralytics package using pip: pip install ultralytics --upgrade This should also handle any necessary updates to OpenVINO. Let me know if this resolves the issue or if there's anything else I can assist you with! 😊 |
@glenn-jocher Yaa but i want to work with old version of openvino |
Hi there! To work with an older version of OpenVINO, you can manually specify the version when installing OpenVINO. For example, if you want to install OpenVINO 2022.2.0, you can use: pip install openvino==2022.2.0 Make sure your environment is compatible with the version you're installing. If you have any more questions or need further assistance, feel free to ask! 😊 |
Hi I manually installed this version but after running the Python code to convert the Yolo v8 pytorch model to the openvino model, Ultralitics automatically updated the openvino version to the latest one |
@achuntelolan what version of ultralytics do you use? |
latest versio |
That's the problem. The Ultralytics package version is linked to the OpenVINO version. If you want to use older OpenVINO, you need to use older Ultralytics as well e.g. 8.0.128 which is linked to OV 2022.3 or higher. So:
|
@adrianboguszewski absolutely! Downgrading both Ultralytics and OpenVINO to versions that are compatible with each other is a good approach. Here's a quick way to do it: pip install ultralytics==8.0.128
pip install openvino==2022.3 Then, you can proceed with the export function as usual. Let me know if this helps or if you run into any other issues! 😊 |
after this changes why iam getting this error : |
Hi @achuntelolan, It looks like the error is due to a missing module, likely because of version mismatches. Here’s a step-by-step to resolve it:
If the issue persists, please share more details about your setup. Happy coding! 😊 |
Yes, I'm using the same version that you gave and this is my script for exporting :
|
Hi @achuntelolan, Thanks for sharing your script! It looks mostly correct, but there might be a small issue with the model path after export. Here’s a refined version: from ultralytics import YOLO
# Load the YOLOv8 model
model = YOLO('best.pt')
# Export the model to OpenVINO format
model.export(format='openvino', imgsz=(640, 384))
# Load the exported OpenVINO model
ov_model = YOLO('best_openvino_model/') # Ensure this matches the export directory
# Run inference
results = ov_model('https://ultralytics.com/images/bus.jpg') Make sure the directory name ( |
actually I am getting the error while exporting so I have a doubt I trained the model in ultralytics latest version and converting with the older version so I just retraining my model with Ultralytics 8.0.128 version and after trying to convert to know if that is any issues will be there, but anyway I am really happy to say that you guys giving a huge support for resolving the issues I didn't got this much support from even from my seniors also thanks @glenn-jocher for your valuable support |
Hi @achuntelolan, Thank you for your kind words! 😊 Yes, training your model with Ultralytics 8.0.128 and then exporting it should resolve the compatibility issues. It's always best to keep the training and exporting environments consistent. If you encounter any further issues or need additional assistance, feel free to reach out. We're here to help! Best of luck with your retraining and exporting! Warm |
Search before asking
Question
I am using the same script of yolov5 to run yolov8 on openvino but its not working. So, how to run yolov8 on OpenVino
Additional
No response
The text was updated successfully, but these errors were encountered: