20、计算机视觉中的目标检测:从YOLOv3到YOLOv7

计算机视觉中的目标检测:从YOLOv3到YOLOv7

1. 目标检测中的平均精度计算

在目标检测中,平均精度(mAP)是评估模型性能的重要指标。以下是计算平均精度的代码实现:

# a dictionary for true_bboxes number on each image
for key, val in amount_bboxes.items():
    amount_bboxes[key] = torch.zeros(val) #===================line 15 
detections.sort(key=lambda x: x[2], reverse=True) #==========line 16 
TP = torch.zeros((len(detections))) 
FP = torch.zeros((len(detections))) 
total_true_bboxes = len(ground_truths) #total true_bboxes in class c 
if total_true_bboxes == 0:
    continue # If no true_bboxes for class c, skip the following codes 
for detection_idx, detection in enumerate(detections): 
    #===line 22
    trueBboxesOnllmg = [ #Pick out all true bboxes on an image 
        bbox for bbox in ground_
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值