A
A
ADKX2021-10-24 10:13:44
Python
ADKX, 2021-10-24 10:13:44

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()


tell me what "results = model(frame)" returns or links where you can see examples of getting the values ​​I need.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question