【发布时间】:2022-08-20 20:57:44
【问题描述】:
有没有办法提取检测到的标签,如person 或cat、dog 或results.print() 函数打印的其他标签?我希望将这些检测到的标签保存在一个数组中并稍后使用。我在这里使用 YOLOv5 模型。
cap = cv2.VideoCapture(0)
while cap.isOpened():
ret, frame = cap.read()
# Make detections
results = model(frame)
results.print()
# Showing the box and prediction
cv2.imshow(\'YOLO\', np.squeeze(results.render()))
if cv2.waitKey(10) & 0xFF == ord(\'q\'):
break
cap.release()
cv2.destroyAllWindows()
results.print() 的打印输出是这样的 -
image 1/1: 480x640 1 person
Speed: 7.0ms pre-process, 80.6ms inference, 3.5ms NMS per image at shape (1, 3, 480, 640)
从这个输出中,我想提取person 标签并将其存储在一个数组中。
标签: deep-learning object-detection yolo yolov5