模拟计算Map的过程,讨论confidence对于map是否有影响

本文详细模拟了目标检测中计算Map的流程,并深入分析了Confidence值如何影响Map的最终结果,揭示了Confidence在评估检测性能中的关键作用。
摘要由CSDN通过智能技术生成
import random
# 模拟计算Map的过程,讨论confidence对于map是否有影响
# 结论,是有影响的。实际上,与gt越接近的预测框的置信度越高,那么实际测出来的map就越高 => 影响precision
# 而且提交的预测框的个数越接近于gt框个数,则map越高 => 影响recall
def voc_ap(rec, prec, use_07_metric=True):
    """ ap = voc_ap(rec, prec, [use_07_metric])
    Compute VOC AP given precision and recall.
    If use_07_metric is true, uses the
    VOC 07 11 point method (default:True).
    """
    if use_07_metric:
        # 11 point metric
        ap = 0.
        for t in np.arange(0., 1.1, 0.1):
            if np.sum(rec >= t) == 0:
                p = 0
            else:
                p = np.max(prec[rec >= t])
            ap = ap + p / 11.
    else:
        # correct AP calculation
        # first append sentinel values at the end
        mrec = np.concatenate(([0.], rec, [1.]))
        mpre = np.concatenate(([0.], prec, [0.]))

        # compute the prec
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值