此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 类
  • FomoConfusionMatrix
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包

fomo_confusion_matrix

最后更新
Python API: luxonis_train.attached_modules.metrics.confusion_matrix.fomo_confusion_matrixFOMO 的混淆矩阵,它将每个预测点周围的小框与目标框进行匹配。

类

FomoConfusionMatrix

FOMO 关键点预测的混淆矩阵。
  • 输入::
    • keypoints (list[Tensor]): 每张图像 [Ki, 1, 4],(x, y, prob, class),像素
    • target_boundingbox (Tensor): [N, 6],[batch, class, x, y, w, h],xywh 归一化
  • 输出::
    • mcc (Tensor): 整个矩阵的标量 MCC,请参阅 compute_mcc
    • confusion_matrix (Tensor): [nclasses + 1, nclasses + 1] 计数,行是目标,最后一行和列是背景
  • 公式:: update 会丢弃每个概率低于 0.5 的关键点。它将每个其他关键点转换为围绕该点的 5x5 像素框,并裁剪到图像。然后 DetectionConfusionMatrix 使用 IoU 阈值 0 计算这些框。因此,当关键点框和目标框共享的面积大于 0 时,目标框和关键点匹配。DetectionConfusionMatrix 的其他规则保持不变。

方法

init
Python
1def __init__(iou_threshold: float | None = None, **kwargs):
使用 IoU 阈值 0 初始化指标。参数
  • iou_threshold (float | None): 忽略。非 None 和 0.0 的值会记录警告。
  • **kwargs: 转发给 DetectionConfusionMatrix 的关键字参数,例如 node。
update
Python
1def update(keypoints: list[Tensor], target_boundingbox: Tensor):
将一个批次的关键点转换为框并计数。keypoints_to_bboxes 会丢弃每个概率低于 0.5 的关键点。它将每个其他关键点转换为围绕该点的 5x5 像素框。它将框裁剪到 BaseAttachedModule.original_in_shape 的高度和宽度。然后 DetectionConfusionMatrix 计数这些框。参数
  • keypoints (list[Tensor]): 每张图像的关键点,形状为 [K_i, 1, 4],表示为像素中的 [x, y, probability, class]。列表的长度是批次大小。
  • target_boundingbox (Tensor): 批次的 boundingbox 标签,形状为 [N, 6],表示为 [batch_index, class, x, y, w, h]。这些值是归一化的,x 和 y 是左上角。该方法将 xyxy 像素写入其中。

属性

supported_tasks