Answer the question
In order to leave comments, you need to log in
Where can I find adequate documentation for torch?
all the guides I found show only the output of a square with a class, I could not find documentation that would tell me how to get the name of the classes, coordinates and accuracy of the found objects to work with them in the code.
import torch
import cv2
import numpy as np
model = torch.hub.load('ultralytics/yolov5', 'custom', path='yolov5/runs/train/exp5/weights/best.pt', force_reload=True)
cap = cv2.VideoCapture(0)
while cap.isOpened():
ret, frame = cap.read()
results = model(frame)
cv2.imshow('YOLO', np.squeeze(results.render()))
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question