ultralytics / ultralytics

NEW - YOLOv8 🚀 in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
28.3k stars 5.63k forks source link

Add cv::cvtColor(image, input_image, cv::COLOR_BGR2RGB); To yolo cpp examples? #15043

Open trns1997 opened 1 month ago

trns1997 commented 1 month ago

Search before asking

Question

We basically used the following example: https://github.com/ultralytics/ultralytics/blob/main/examples/YOLOv8-LibTorch-CPP-Inference/main.cc test libtorch's cpp api to load our model and predict objects in an image. We initially had problems when performing inference, the output prediction were garbage, and after a bit of searching figured out that open cv read images in BGR format and we trained our model in python using RGB format. I was wondering if it is worth mentioning somewhere or adding a note that Add cv::cvtColor(image, input_image, cv::COLOR_BGR2RGB); if model trained on images with RGB format, and opencv reads in BGR format. Let me know what you think. I think it is worth mentioning the issue :)

Additional

No response

github-actions[bot] commented 1 month ago

👋 Hello @trns1997, 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.

trns1997 commented 1 month ago

@pderrenger we're using the latest version, and everything works perfectly. We just spent sometime figuring out where the problem was coming from, finally not an ultralytics problem, just a problem regarding how the input data is read. Yes it would be great to add this as a note for future users :) .