GithubHelp home page GithubHelp logo

Comments (8)

glenn-jocher avatar glenn-jocher commented on July 24, 2024

@mrortach hello,

Thank you for bringing this to our attention. To assist you effectively, could you please provide a minimum reproducible code example? This will help us replicate the issue on our end and investigate further. You can find guidelines on creating a reproducible example here: Minimum Reproducible Example.

Additionally, please ensure that you are using the latest versions of torch and ultralytics. Sometimes, performance issues can be resolved by updating these packages. You can upgrade them using the following commands:

pip install --upgrade torch ultralytics

Once you've updated the packages and provided the reproducible example, we can delve deeper into the issue. Your detailed observations and the steps you've already taken are very helpful, and we'll do our best to assist you in resolving this performance discrepancy.

Thank you for your cooperation and patience!

from ultralytics.

mrortach avatar mrortach commented on July 24, 2024

Yolov10 does not work with ultralytics.
(+)https://github.com/THU-MIG/yolov10.git
(-)pip install --upgrade torch ultralytics

import cv2
import torch
import numpy as np
import supervision as sv  # type: ignore
from ultralytics import YOLOv10

print("Starting script...")

# Load the YOLOv10 model
model = YOLOv10("yolov10x.pt")

# Create annotators
bounding_box_annotator = sv.BoundingBoxAnnotator()
label_annotator = sv.LabelAnnotator()

# Create a VideoCapture object for the webcam
cap = cv2.VideoCapture(0)  # Change the index if you have multiple cameras

if not cap.isOpened():
    print("Unable to read camera feed")
    exit()

while True:
    ret, frame = cap.read()

    if not ret:
        print("Failed to grab frame")
        break

    # Perform object detection on the frame from the camera
    results = model(frame)[0]
    detections = sv.Detections.from_ultralytics(results)
    annotated_image = bounding_box_annotator.annotate(scene=frame, detections=detections)
    annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)

    # Show the annotated image
    cv2.imshow('YOLOv10 Detection', annotated_image)

    k = cv2.waitKey(1)
    if k % 256 == 27:  # Press 'Esc' to exit
        print("Escape hit, closing...")
        break

cap.release()
cv2.destroyAllWindows()
print("Pipeline stopped.")

from ultralytics.

glenn-jocher avatar glenn-jocher commented on July 24, 2024

Hello @mrortach,

Thank you for sharing your script and the detailed information. It looks like you're encountering issues with YOLOv10 integration using the Ultralytics library.

Firstly, I noticed that you are using YOLOv10 from the ultralytics package, which is not officially supported. The official Ultralytics repository currently supports YOLOv8 and other models, but not YOLOv10. For YOLOv10, you should use the repository you mentioned: THU-MIG/yolov10.

Here's a revised version of your script using the official YOLOv10 repository:

import cv2
import torch
import numpy as np
import supervision as sv  # type: ignore
from yolov10 import YOLOv10  # Ensure you have the correct import

print("Starting script...")

# Load the YOLOv10 model
model = YOLOv10("yolov10x.pt")

# Create annotators
bounding_box_annotator = sv.BoundingBoxAnnotator()
label_annotator = sv.LabelAnnotator()

# Create a VideoCapture object for the webcam
cap = cv2.VideoCapture(0)  # Change the index if you have multiple cameras

if not cap.isOpened():
    print("Unable to read camera feed")
    exit()

while True:
    ret, frame = cap.read()

    if not ret:
        print("Failed to grab frame")
        break

    # Perform object detection on the frame from the camera
    results = model(frame)[0]
    detections = sv.Detections.from_ultralytics(results)
    annotated_image = bounding_box_annotator.annotate(scene=frame, detections=detections)
    annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)

    # Show the annotated image
    cv2.imshow('YOLOv10 Detection', annotated_image)

    k = cv2.waitKey(1)
    if k % 256 == 27:  # Press 'Esc' to exit
        print("Escape hit, closing...")
        break

cap.release()
cv2.destroyAllWindows()
print("Pipeline stopped.")

Please ensure you have the correct dependencies installed for YOLOv10 from the THU-MIG repository. You can follow their installation instructions to set up your environment correctly.

If you encounter any further issues, please provide additional details or error messages so we can assist you better. Also, make sure to use the latest versions of torch and ultralytics if you switch back to using YOLOv8 or other supported models.

Feel free to reach out if you have more questions. Happy coding! 😊

from ultralytics.

mrortach avatar mrortach commented on July 24, 2024

Actually, running my own code is not a problem; it works. However, it runs very slowly with the real-time camera on versions below 3.12

from ultralytics.

mrortach avatar mrortach commented on July 24, 2024

3.11 https://www.youtube.com/watch?v=UE4mYQ-T4Ds
3.12 https://www.youtube.com/watch?v=HXosSZJlrBg

You can look terminal 3.12 so fast, 3.11 so slow.

from ultralytics.

glenn-jocher avatar glenn-jocher commented on July 24, 2024

Hello @mrortach,

Thank you for providing the video comparisons. It's clear that there's a significant performance difference between versions 3.11 and 3.12 of YOLOv10.

To help us investigate this issue further, could you please provide a minimum reproducible code example? This will allow us to replicate the issue on our end. You can find guidelines on creating a reproducible example here: Minimum Reproducible Example. This step is crucial for us to understand the root cause of the performance discrepancy.

Additionally, please ensure you are using the latest versions of torch and ultralytics. Sometimes, performance issues can be resolved by updating these packages. You can upgrade them using the following commands:

pip install --upgrade torch ultralytics

Once you provide the reproducible example and confirm that you are using the latest versions, we can delve deeper into the issue. Your detailed observations and the steps you've already taken are very helpful, and we'll do our best to assist you in resolving this performance discrepancy.

Thank you for your cooperation and patience! 😊

from ultralytics.

mrortach avatar mrortach commented on July 24, 2024

pip install --upgrade torch

Ultralytics does not support it, sir, I am using Yolov10. pip install -q git+https://github.com/THU-MIG/yolov10.git

import cv2
import torch
import numpy as np
import supervision as sv  # type: ignore
from ultralytics import YOLOv10

# Modeli yüklerken bu yolu kullanın
model = YOLOv10("yolov10x.pt")

bounding_box_annotator = sv.BoundingBoxAnnotator()
label_annotator = sv.LabelAnnotator()

# Tek kamera için VideoCapture nesnesi oluşturun
cap = cv2.VideoCapture(1)

if not cap.isOpened():
    print("Unable to read camera feed from camera")
    exit()

while True:
    ret, frame = cap.read()

    if not ret:
        break

    # Kamera'dan gelen görüntü için nesne tespiti
    results = model(frame)[0]
    detections = sv.Detections.from_ultralytics(results)
    annotated_image = bounding_box_annotator.annotate(scene=frame, detections=detections)
    annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)

    # Görüntüyü ekranda göster
    cv2.imshow('Webcam', annotated_image)

    k = cv2.waitKey(1)
    if k % 256 == 27:
        print("Escape hit, closing...")
        break

cap.release()
cv2.destroyAllWindows()

from ultralytics.

glenn-jocher avatar glenn-jocher commented on July 24, 2024

Hello @mrortach,

Thank you for your detailed comment and for providing the code snippet. It's great to see your proactive approach in troubleshooting the issue.

To help us investigate the performance discrepancy between YOLOv10 versions 3.11 and 3.12, could you please provide a minimum reproducible code example? This will enable us to replicate the issue on our end and identify the root cause. You can find guidelines on creating a reproducible example here: Minimum Reproducible Example. This step is crucial for us to understand the exact problem and work towards a solution.

Additionally, please ensure that you are using the latest versions of torch and ultralytics. Sometimes, performance issues can be resolved by updating these packages. You can upgrade them using the following command:

pip install --upgrade torch ultralytics

Once you provide the reproducible example and confirm that you are using the latest versions, we can delve deeper into the issue. Your detailed observations and the steps you've already taken are very helpful, and we'll do our best to assist you in resolving this performance discrepancy.

Thank you for your cooperation and patience! 😊

from ultralytics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.