YoloV5 卡在 Adding Autoshape 上

问题描述 投票:0回答:0

我目前正在尝试使用我的网络摄像头部署自定义 Yolov5 模型。当我为图像运行它时,我得到了结果,但是当我用它从我的网络摄像头获取实时对象检测时,它卡在了添加自选图形..

model = torch.hub.load('yolov5', 'custom', path='best.pt', source='local', 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()


Expected end or semicolon (after name and no valid version specifier)
    blinker       1.6.2
                  ^
YOLOv5 🚀 v7.0-162-gc3e4e94 Python-3.10.0 torch-2.0.1 CPU

Fusing layers... 
Model summary: 212 layers, 20953959 parameters, 0 gradients, 48.2 GFLOPs
Adding AutoShape... 

Ive 尝试使用自动形状作为 false 或添加帧大小但后来我得到另一个错误,因为图像有 3 个值,而根据我的理解它需要解包 4。我将不胜感激对此有一些见解。提前致谢

python machine-learning pytorch computer-vision yolo
© www.soinside.com 2019 - 2024. All rights reserved.