目标检测的性能指标

  • 前传耗时(ms):从输入- 张图像到输出最终结果所消耗的时间,包括前处理耗时(如图像归一化)、网络前传耗时、后处理耗时(如非极大值抑制)
  • 每秒帧数FPS (Frames Per Second): 每秒钟能处理的图像数量
  • 浮点运算量(FLOPS):处理一张图像所需要的浮点运算数量,跟具体软硬件没有关系,可以公平地比较不同算法之间的检测速度。

利用混淆矩阵理解

  • recall:真实框有多少被预测正确(TTP、TFN)
  • precision:预测框中有多少真实框(TTP、FFP

  •  AP衡量的是学习出来的模型在每个类别上的好坏
  • mAP衡量的是学出的模型在所有类别上的好坏。mAP就是取所有类别.上AP的平均值。

论文中出现的AP含义:

 

 注意:IOU越大,对检测框要求越苛刻。

 

 AP的三种计算法方式:

 

 最后一种就是求积分。

  • Pascal VOC2007uses 11 Recall points on PR curve.
  • Pascal VOC2010-2012 uses (all points) Area Under Curve (AUC) on PR curve.
  • MS COCO uses 101 Recall points on PR curve as well as different loU thresholds.

参考:cocoapi如何计算map_buddhisant的博客-CSDN博客_coco map

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
目标检测性能指标包括精度和速度两个方面。常用的精度指标有mAP(mean average precision)、PR曲线、ROC曲线等;常用的速度指标有FPS(frames per second,每秒处理帧数)、推理时间等。以下是使用Python和OpenCV计算mAP的示例代码: ```python import numpy as np def calculate_iou(box1, box2): x1, y1, w1, h1 = box1 x2, y2, w2, h2 = box2 xi1 = max(x1, x2) yi1 = max(y1, y2) xi2 = min(x1 + w1, x2 + w2) yi2 = min(y1 + h1, y2 + h2) iw = max(xi2 - xi1, 0) ih = max(yi2 - yi1, 0) ua = (w1 * h1 + w2 * h2 - iw * ih) iou = iw * ih / ua return iou def calculate_ap(gt_boxes, pred_boxes, iou_threshold=0.5): tp = [0] * len(pred_boxes) fp = [0] * len(pred_boxes) gt_detected = [False] * len(gt_boxes) pred_scores = [box[0] for box in pred_boxes] order = np.argsort(pred_scores)[::-1] for i in order: _, pred_box, pred_class = pred_boxes[i] max_iou = -float('inf') max_idx = -1 for j, gt_box in enumerate(gt_boxes): if pred_class != gt_box[0]: continue iou = calculate_iou(pred_box, gt_box[1:]) if iou > max_iou: max_iou = iou max_idx = j if max_iou >= iou_threshold: if not gt_detected[max_idx]: tp[i] = 1 gt_detected[max_idx] = True else: fp[i] = 1 else: fp[i] = 1 tp_acc = np.cumsum(tp) fp_acc = np.cumsum(fp) recall = tp_acc / len(gt_boxes) precision = tp_acc / (tp_acc + fp_acc) ap = 0 for t in np.arange(0, 1.1, 0.1): if np.sum(recall >= t) == 0: p = 0 else: p = np.max(precision[recall >= t]) ap += p / 11 return ap def calculate_map(gt_boxes_list, pred_boxes_list, iou_threshold=0.5): aps = [] for c in range(len(gt_boxes_list)): gt_boxes = gt_boxes_list[c] pred_boxes = pred_boxes_list[c] ap = calculate_ap(gt_boxes, pred_boxes, iou_threshold) aps.append(ap) map = sum(aps) / len(aps) return map ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值