请问怎然才能返回目标物体的类别,比如这个怎样才能返回red,或者green,用的yolov5-master源代码检测
import torch
from matplotlib import pyplot as plt
import numpy as np
import cv2
import time
import string
import pygame
#model = torch.hub.load("ultralytics/yolov5","yolov5s")
model = torch.hub.load('D:/ks/yolov5-master','custom','runs/train/exp11/weights/best.pt', source='local')
model.conf=0.4
video_path = "./data/images/hld.mp4"
cap = cv2.VideoCapture(video_path)
#cap = cv2.VideoCapture(0)
while cap.isOpened():
# 参数ret 为True 或者False,代表有没有读取到图片帧
# 第二个参数frame表示截取到一帧的图片
ret,frame = cap.read()
# 将图片帧输入模型
frame=cv2.resize(frame,(500,500))
results = model(frame)
print(results)
#LOGGER.info(f"{names[int(c)]}"))
#print(results.names)
cv2.imshow('YOLO',np.squeeze(results.render()))
# 退出
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()