简体   繁体   中英

Retrieve confidence value Yolov5

I'm using this code to load the yolov5 model model = torch.hub.load('ultralytics/yolov5', 'custom', 'C:\Object Detection\yolov5_object_detection\last.pt') and how can I retrieve the confidence value after the model detected on an image?

model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)
model.eval()
det = model(img)

for *xyxy, conf, cls in det:
    print(*xyxy)
    print(conf)   # what you are looking for
    print(cls)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM