-1

In both of below approaches, I am getting blank image but yolo is printing the prediction results.

import torch
import cv2

model = torch.hub.load('ultralytics/yolov5', 'yolov5m')
img = cv2.imread("assets/images.jpeg")
results = model(img)
# im_rgb = results.render()
# img_boxes = im_rgb[0]
im_rgb = cv2.cvtColor(results.ims[0], cv2.COLOR_BGR2RGB)
print(results.pandas().xyxy[0])
cv2.imshow("Result",im_rgb)
Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36

1 Answers1

0

cv2.imshow() doesn't work without a following cv2.waitKey(). Check your image is not null after opening, – Mark Setchell

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 16 '23 at 21:08