【目标检测】Faster-RCNN

anchor: anchor我理解为proposal的前身。sliding window处理feature map时,根据scale和aspect ratio产生anchor。对于H * W的feature map, scale和aspect ratio等于3,则共有9HW个anchor。anchor经过映射和FCs处理后产生最终的proposal。

目录

Intruduction

Region Proposal Networks

Translation-Invariant Anchors

Region Proposal的loss function

1. Positive / negative excample规则

2. loss function


 

Intruduction

目前目标检测的主要问题是:寻找Region proposal耗费了大量时间。Region Proposal Network (RPN)与目标检测网络共享entire feature map。通过测试时共享卷积,计算proposal的边际成本可以忽略不计(10ms/image)

在共享conv特征的顶端,通过增加两个额外的conv 层建立了RPNs:其中一个将conv map position编码为一个简短的特征向量;另一个输出目标分数和k个region proposals的regress box(包含两个变量:various scales\aspect ratios)。

与fast r-cnn相似,包含预训练。fine-tuning时交替训练region proposal和目标检测,收敛快。

 

Region Proposal Networks

【目标检测】Faster-RCNN

RPN将一张图片作为输入,输出一系列矩形框和对应objectness score。

在最后一个输出conv feature map的共享conv层上移动一个小的n x n spatial window(sliding window,本文使用n = 3)。每一个sliding windows输出一个更低维度的向量。这个向量输入到两个全连接层:box-regression层和box-classification层。

全连接层对所有spatial locations都是共享的。

 

Translation-Invariant Anchors

对每一个sliding-window,同时预测k个region proposals,reg层输出4k个参数(中心点坐标和高、宽),cls层输出2k个分数(每个proposal它是目标/不是目标的概率)。k个proposal和k个reference box相关,reference box又被称为anchor。Anchor在sliding window的中间,并且含有scale和aspect ratio两个参数。

使用3个scale和aspect ratio参数,对每个sliding windows共有k = 9个anchors。对一个W x H的conv feature map,总共则有WHk个anchors。Anchors具有平移不变性。

 

Region Proposal的loss function

1. Positive / negative excample规则

  • Positive example:(1)和某个ground-truth box有最高的IoU的anchor;(2)和任一一个ground-truth box的IoU超过0.7的anchor。
  • Negative example:和所有ground-truth的IoU小于0.3
  • 其余样本不用于训练。

2. loss function

【目标检测】Faster-RCNN

  • i是anchor在mini-batch中的索引
  • pi是anchor是object的可能性
  • if anchor是positive的,pi*=1;anchor是negative,pi*-0
  • ti是预测bbox的4个参数化坐标的向量
  • ti*是和positive anchor相关的ground-truth box的坐标向量
  • Lcls是object/non-object两类的的log loss

【目标检测】Faster-RCNN

  • R()与Fast R-CNN相同

【目标检测】Faster-RCNN

  • x, y, w, h是box的中心点坐标和宽、高
  • x, xa, x*是predicted box, anchor box, ground-truth box

参考:https://zhuanlan.zhihu.com/p/31426458

相关文章: