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)
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()
else: print("rtsp open failed")
cv2.destroyAllWindows()