ultralytics / ultralytics

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

Don't know whether this is a bug. #19077

Open Ilovecode93 opened 1 week ago

Ilovecode93 commented 1 week ago

Search before asking

Ultralytics YOLO Component

No response

Bug

I create my own custom dataset and have trained it with yolov8 successfully, but when I tried to predict the images with the best model that I got. An image in the test set was completely wrong, other images were predicted successfully, how does that happen? Here is the bug image in the test set.

Image The result image:

Image

Environment

Ultralytics YOLOv8.2.90 🚀 Python-3.11.9 torch-2.4.0+cu121 CUDA:0 (NVIDIA A100-PCIE-40GB, 40339MiB) Setup complete ✅ (96 CPUs, 754.4 GB RAM, 401.0/438.9 GB disk)

OS Linux-5.15.0-113-generic-x86_64-with-glibc2.35 Environment Linux Python 3.11.9 Install pip RAM 754.35 GB CPU Intel Xeon Gold 6248R 3.00GHz CUDA 12.1

Minimal Reproducible Example

from ultralytics import YOLO

# Load a model
model = YOLO("2_4/weights/best.pt")  
# Run batched inference on a list of images
results = model(["./0007.jpg",])  # return a list of Results objects
#results = model(["./0007.jpg",])  # return a list of Results objects

# Process results list
for result in results:
    boxes = result.boxes  # Boxes object for bounding box outputs
    masks = result.masks  # Masks object for segmentation masks outputs
    keypoints = result.keypoints  # Keypoints object for pose outputs
    probs = result.probs  # Probs object for classification outputs
    obb = result.obb  # Oriented boxes object for OBB outputs
    result.show()  # display to screen
    result.save(filename="result.jpg")  # save to disk

Additional

No response

Are you willing to submit a PR?

UltralyticsAssistant commented 1 week ago

👋 Hello @Ilovecode93, thank you for your interest in Ultralytics 🚀! 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 verify that the issue persists with the latest version of the ultralytics package by upgrading all dependencies in your environment as shown below:

pip install -U ultralytics

If the issue persists, kindly provide a minimum reproducible example (MRE) to help us reproduce and debug the problem. For example:

  1. Include the full training command used, logs, and script (if custom training code is used).
  2. Share details about the dataset (e.g., image sizes, label formatting, etc.) and configuration files (like data.yaml or model.yaml).
  3. Check whether your test images have the same preprocessing and normalization as the training data.
  4. Provide the code that loads the model and performs inference, along with any input images causing the issue.

If this is a ❓ Custom Training Question, providing additional details like the dataset configuration, training settings, and logs will help us better understand your situation.

For real-time conversation and support, feel free to join our Discord 🎧. For longer discussions, head over to Discourse or share insights on our Subreddit.

Upgrade

Ensure you are using the latest supported Python (>=3.8) and PyTorch (>=1.8) versions. Refer to the requirements for more details.

Verified Environments

For compatibility and smooth execution, YOLO has been verified in various environments, which include:

Status

Ultralytics CI

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

⚠️ Please note that this is an automated response. Rest assured, an Ultralytics engineer will review your issue and assist you soon! 🚀

Y-T-G commented 1 week ago

Is this OBB model?

Ilovecode93 commented 1 week ago

@Y-T-G No, and I have found how to solve this issue. It seems that this photo was taken by the cellphone and when I try to pass the image_path to the model() function, pillow load this picture reversal automatically.