Yolov8 bbox 解码

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

从下面的图片(取自这里),我们可以看到

yolov8
中的bbox输出具有大小
4 x reg_max
。在 yolov8 实现中,
reg_max
设置为 16(16 个预测 bbox),因此输出大小为 64。

如何根据 16 个提案计算最终的 bbox?

enter image description here

yolo yolov8
1个回答
0
投票

据我了解,此任务是由非极大值抑制(NMS)过程执行的。

一种过滤目标检测器预测的技术。 输入:提案框 B 的列表,相应的置信度分数 S 和 重叠阈值 N。输出:过滤后的提案 D 的列表。 https://towardsdatascience.com/non-maximum-suppression-nms-93ce178e177c

predict.py ultralytics 模块中:

def postprocess(self, preds, img, orig_imgs):
    """Post-processes predictions and returns a list of Results objects."""
    preds = ops.non_max_suppression(
            preds,
            self.args.conf,
            self.args.iou,
            agnostic=self.args.agnostic_nms,
            max_det=self.args.max_det,
            classes=self.args.classes,
        )
    # ... the rest of method logic

ops.py ultralytics 模块中:

def non_max_suppression(
    prediction,
    conf_thres=0.25,
    iou_thres=0.45,
    classes=None,
    agnostic=False,
    multi_label=False,
    labels=(),
    max_det=300,
    nc=0,  # number of classes (optional)
    max_time_img=0.05,
    max_nms=30000,
    max_wh=7680,
    in_place=True,
    rotated=False,
):
    """
    Perform non-maximum suppression (NMS) on a set of boxes, 
    with support for masks and multiple labels per box.
    Returns:
        (List[torch.Tensor]): A list of length batch_size, where each element is a tensor of
        shape (num_boxes, 6 + num_masks) containing the kept boxes, with columns
        (x1, y1, x2, y2, confidence, class, mask1, mask2, ...).
"""
    # ... the rest of method logic
© www.soinside.com 2019 - 2024. All rights reserved.