ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
32.37k stars 6.22k forks source link

yolov8 onnx convertion issue #8010

Closed sredouane closed 7 months ago

sredouane commented 9 months ago

Search before asking

YOLOv8 Component

Export

Bug

the network can only detect humain, in other word it sees only classId 0. The humain detection is very good and have the correct bounding box.

Environment

tested on cpu docker image running on my windows virtual machine with i7/16gig ram. tested on my ubuntu on terminal (no docker) using cpu conversion with amd rayzen 7/128gig ram.

Minimal Reproducible Example

Create docker image using https://github.com/ultralytics/ultralytics/blob/main/docker/Dockerfile

Convert to onnx format:

ADD https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8l.pt /usr/src/ultralytics/ yolo export model=/usr/src/ultralytics/yolov8l.pt format=onnx imgsz=640

Use the result in opencv c++ same as https://github.com/ultralytics/ultralytics/blob/main/examples/YOLOv8-CPP-Inference/inference.cpp

Current result: the network can only detect humain, in other word it sees only classId 0. The humain detection is very good and have the correct bounding box.

Expected: detect all classId from 0 to 79

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 9 months ago

👋 Hello @sredouane, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Kutayykilic commented 9 months ago

There's nothing wrong with your code. Did you try the X model? And what video are you running the model on? I don't think it has all the available COCO classes.

sredouane commented 9 months ago

I tried all the model sizes they give the same result. The video feed have me, chair, banana, bottel remote controler. The yolo 5 see them all. Exported yolov8 see me only. If go off screen and keep the others it sees nothing.

glenn-jocher commented 9 months ago

@sredouane it sounds like the model is not generalizing to other classes beyond 'person'. This could be due to a variety of reasons, such as an issue with the export process or a problem with the model weights. To troubleshoot, please ensure you're using the latest version of the YOLOv8 repository and follow the export instructions carefully. If the problem persists, consider validating the ONNX model with a known dataset to check if the issue is with the model or the video feed content. If the model performs well on the dataset but not on your video, it might be an issue with the input data or preprocessing steps. If you continue to experience issues, please open a detailed issue on the repo with all the steps you've taken so we can investigate further. 🕵️‍♂️

sredouane commented 9 months ago
glenn-jocher commented 9 months ago

@sredouane hello! Yes, your git clone command for main branch will pull the latest code.

It seems like the model is only detecting the 'person' class (classId 0) and not the other classes. This is certainly unusual behavior, especially since you mentioned that the human detection is working well.

To help us diagnose the issue, could you please confirm if you've tried running inference with the original .pt model file on the same dataset to ensure that it's capable of detecting all classes as expected?

Additionally, it would be helpful if you could share the command or script you're using to run the inference with the ONNX model, as well as any output logs or error messages you might be receiving.

In the meantime, you might want to ensure that the export process is completed without errors and that the ONNX model is being loaded correctly in your OpenCV C++ environment.

We appreciate your cooperation and are here to assist you in resolving this issue. 🛠️

github-actions[bot] commented 8 months ago

👋 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 ⭐