THU-MIG / yolov10

YOLOv10: Real-Time End-to-End Object Detection [NeurIPS 2024]
https://arxiv.org/abs/2405.14458
GNU Affero General Public License v3.0
9.89k stars 976 forks source link

Incorrect Inference Result #85

Closed SMDIndomitable closed 5 months ago

SMDIndomitable commented 5 months ago

I am using the Nvidia Orin Agx

I have converted the model .pt to .engine via the yolo export cli command provided in the repo.

However, when I start to predict using the following code, the inference result is completely wrong, please help!

from PIL import Image from ultralytics import YOLO import cv2

Load a pretrained YOLOv10m model

model = YOLO("/home/QPipeline/volume/Models/yolov10m.pt")

source = "videostream"

cap = cv2.VideoCapture(source) if cap.isOpened(): cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE) while True: ret_val, img = cap.read()

    if (not ret_val):
        continue
    # Run inference on 'bus.jpg'
    results = model.predict(img, imgsz=640, classes = [0])  # results list

    #Visualize the results
    for i, r in enumerate(results):
        # Plot results image
        im_bgr = r.plot()  # BGR-order numpy array
        #im_rgb = Image.fromarray(im_bgr[..., ::-1])  # RGB-order PIL image

        # Show results to screen (in supported environments)
        # r.show()

        # Save results to disk
        #r.save(filename=f"results{i}.jpg")
    cv2.imshow('demo',im_bgr)
    cv2.waitKey(1)

else: print("rtsp open failed")

cv2.destroyAllWindows()

SMDIndomitable commented 5 months ago

Hi, please use YOLOv10 instead of YOLO, thanks