1

this is my code

    import torch
    import cv2
    import numpy as np
    import pandas
    """leemos el modelo"""
    model = torch.hub.load('ultralytics/yolov5', 'custom',path = r"C:\Users\sandr\PycharmProjects\pythonraton\rat_ia.pt")
    cap =cv2.VideoCapture(0) 
    while True:
     ret, frame =cap.read()
     tamaño = cv2.resize(frame, (720, 480))
     detec = model(tamaño)
     info =detec.pandas().xyxy[0]
     print(info)
     cv2.imshow('detector de ratas',np.squeeze(detec.render()))
     escape = cv2.waitKey(5)
     if escape == 1:
      break
    cap.release()
    cv2.destroyAllWindows()

this is the result but I only want to extract xmin and xmax

I hope you can help me the data extraction I plan to save it in an array to plot later with matplot and if there is another way do not hesitate to comment.

0 Answers0