检索置信值Yolov5



我使用此代码来加载yolov5模型model = torch.hub.load('ultralytics/yolov5', 'custom', 'C:Object Detectionyolov5_object_detectionlast.pt'),我如何在图像上检测到模型后检索置信度值?

加载模型,向其提供图像,循环遍历预测并提取其内容。

model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)
model.eval()
det = model(img)  # feed image
for *xyxy, conf, cls in det:  # loop through results and extract contents
print(*xyxy)
print(conf)   # what you are looking for
print(cls)

相关内容

  • 没有找到相关文章

最新更新