SSD检测模型中matcher策略源码解析

本文深入探讨SSD目标检测模型的匹配策略,通过分析论文原理和源码,解释了匹配过程,包括如何处理IoU大于0.5的情况,并重点关注了ArgMaxMatcher类的关键功能,解释了其如何确保每个ground truth至少有一个匹配的anchor。
摘要由CSDN通过智能技术生成

计算机视觉交流群:677855967,欢迎大家加入交流。

继上一篇博文https://blog.csdn.net/yuanlunxi/article/details/84673425分析了hardexample mining之后,我们留下了一个问题,就是为何ssd检测模型训练过程中会出现正负样本为0的情况?在查阅了一番资料之后,今天决定把这个问题杀了祭天,不正之处,多拍板转。

要弄清楚这个问题,首先我们必须清楚ssd检测模型的中match策略:照例,先看论文找原理;再去源码看实现细节。

论文原理:很简短的一个介绍:

译文:在生成的anchor和gt box中,match分两步:1:对所有的gtbox选择与它iou最大的anchor(default box)进行匹配;2:对所有的anchor,选择任何与它iou大于0.5的gtbox进行匹配。

这里思考个问题:当一个anchor与两个gtbox的iou阈值大于0.5时,这个anchor是如何match的呢?

带着这个问题我们去看看源码:SSD训练时选择是ArgMaxMatcher()这个类:看一下这个累的源码:也可以戳 argmax_matcher.py

class ArgMaxMatcher(matcher.Matcher):
  """Matcher based on highest value.

  This class computes matches from a similarity matrix. Each column is matched
  to a single row.

  To support object detection target assignment this class enables setting both
  matched_threshold (upper threshold) and unmatched_threshold (lower thresholds)
  defining three categories of similarity which define whether examples are
  positive, negative, or ignored:
  (1) similarity >= matched_threshold: Highest similarity. Matched/Positive!
  (2) matched_threshold > similarity >= unmatched_threshold: Medium similarity.
          Depending on negatives_lower_than_unmatched, this is either
          Unmatched/Negative OR Ignore.
  (3) unmatched_threshold > similarity: Lowest similarity. Depending on flag
          negatives_lower_than_unmatched, either Unmatched/Negative OR Ignore.
  For ignored matches this class sets the values in the Match object to -2.
  "&
  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值