Ultralytics YOLOv8 `probs` 属性返回 `None` 用于对象检测

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

我正在使用 Ultralytics YOLOv8 实现对图像执行对象检测。但是,当我尝试使用结果对象中的

probs
属性检索分类概率时,它返回
None
。这是我的代码:

from ultralytics import YOLO

# Load a model
model = YOLO('yolov8n.pt')  # pretrained YOLOv8n model

# Run batched inference on a list of images
results = model('00000.png')  # return a list of Results objects

# Process results list
for result in results:
    boxes = result.boxes  # Boxes object for bbox outputs
    masks = result.masks  # Masks object for segmentation masks outputs
    keypoints = result.keypoints  # Keypoints object for pose outputs
    probs = result.probs  # Probs object for classification outputs

print(probs)

当我运行上面的代码时,

print(probs)
的输出是
None
。剩余的输出是

image 1/1 00000.png: 640x640 1 person, 1 zebra, 7.8ms
Speed: 2.6ms preprocess, 7.8ms inference, 1.3ms postprocess per image at shape (1, 3, 640, 640)

为什么 probs 属性返回

None
,如何检索每个检测到的对象的分类概率? Ultralytics YOLOv8 实现中的这种行为背后是否有特定的设计原因?

python object-detection yolov8
1个回答
0
投票

我想你应该能够通过

results[0].boxes.conf
获得信心。

probs 属性似乎在 Yolov8 中不起作用

© www.soinside.com 2019 - 2024. All rights reserved.