【Faster RCNN】《Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks》

这里写图片描述

NIPS-2015

NIPS,全称神经信息处理系统大会(Conference and Workshop on Neural Information Processing Systems),是一个关于机器学习和计算神经科学的国际会议。该会议固定在每年的12月举行,由NIPS基金会主办。NIPS是机器学习领域的顶级会议 。在中国计算机学会的国际学术会议排名中,NIPS为人工智能领域的A类会议。



1 Motivation

State-of-the-art object detection networks depend on region proposal algorithms to hypothesize object locations. Advances like SPPnet and Fast R-CNN have reduced the running time of these detection networks, exposing region proposal computation as a bottleneck.

作者提出 Region Proposal Network (RPN) that shares full-image convolutional features with the detection network, thus enabling nearly cost-free region proposals(10ms per image).

2 Innovation

RPN,end to end

这里写图片描述

不是用 image pyramid 图1(a),也不是用 filter pyramid,图1(b),而是用 anchor,图一(c),可以叫做,pyramid of regression references

3 Advantages

  • 5fps (including all steps) on a GPU——VGG
  • state-of-the-art object detection accuracy on PASCAL VOC 2007, 2012, and MS COCO datasets with only 300 proposals per image
  • ILSVRC and COCO 2015 competitions,the foundations of the 1st-place winning entries(eg:ResNet)

4 Methods

SS慢,EdgeBoxes 虽然能达到 0.2 second per image(和检测的时间差不多了),一个很直接的想法就是在 GPU上实现这些算法,但是 re-implementation ignores the down-stream detection network and therefore misses important opportunities for sharing computation.

相关工作先介绍了 object proposal的情况,然后是 Deep Net works for object detection(主要是 RCNN, fast RCNN 和 OverFeat),个人感觉对RCNN 和 OverFeat 的总结很精辟

R-CNN mainly plays as a classifier, and it does not predict object bounds (except for refining by bounding box regression).

In the OverFeat method, a fully-connected layer is trained to predict the box coordinates for the localization task that assumes a single object.

4.1 RPN

Note: RPN is class-agnostic 【R-FCN】《R-FCN: Object Detection via Region-based Fully Convolutional Networks》

4.1.1 Anchors

共享卷积的最后一层,ZF有 5 layers(256 dimension),VGG 有13 layers(512 dimension),

这里写图片描述

2k中 2 是 object or not object,k是每个3*3的 sliding window 中 anchor数量, 4k 中的 4 是 bbox

ratios 和 scales 的威力如下:
这里写图片描述

  • Translation-Invariant anchors

相比与 MultiBox的方法,Faster RCNN的 anchor 基于卷积,有 translation-invariant 的性质,而且 参数量更少,(4+2)* k * dimension(eg,k=9,VGG dimension为512) parameters 为 2.8 ∗ 1 0 4 2.8*10^4 2.8104,更少的参数量的好处是,less risk of overfitting on small datasets,like PASCAL VOC

  • Multi-Scale Anchors as Regression References

区别于 image pyramid 和 filter pyramid,作者用 anchor pyramid(不同的 scales 和 ratios),more cost-efficient,因为 only relies on images and feature maps of a single scales and uses filters(sliding windows on feature map)of a single size.

这里写图片描述

4.1.2 Loss Function

每个anchor进行2分类,object or not,positive 为 IoU>0.5或者max IoU,negative 为 IoU<0.3,其它的anchor对训练来说没有用

这里写图片描述

损失函数如下
这里写图片描述

  • i i i:minibatch 中 i − t h i -th ith anchor
  • p i p_i pi:predicted probability of anchor i i i being an object.
  • p i ∗ p_i^* pi:is 1 if the anchor is positive, 0 if the anchor is negative
  • t i t_i ti:4 parameterized coordinates of the predicted bounding box
  • t i ∗ t_i^* tiground-truth box associated with a positive anchor
  • L c l s L_{cls} Lcls:log loss
  • L r e g L_{reg} Lreg:Smooth L1 loss,前面乘以了 p i ∗ p_i^* pi 表示 regression loss is activated only for positive anchors

Normalized by N c l s N_{cls} Ncls N r e g N_{reg} Nreg(normalization is not required and could be simplified), λ \lambda λ 用来 balance parameters

  • N c l s N_{cls} Ncls 设置为 mini-batch的大小,eg:256
  • N r e g N_{reg} Nreg 设置为 numbers of anchor locations(~2400)
  • λ \lambda λ 设置为 10,正好两种损失55开

λ \lambda λ 的影响如下,Insensitive
这里写图片描述

具体的 t i t_i ti t i ∗ t_i^* ti 如下:
这里写图片描述

x,y 是 predict box 的中心,w 和 h 分别是 宽和高
$x,x_a,x^* $ 分别表示 predict-box,anchor box 和 ground-truth box,y,h,w 的表示方法也一样

This can be thought of as bounding-box regression from an anchor box to a nearby ground-truth box.说白了,就是计算 (predict box 与 anchor 的 偏差) 和 (ground-truth 与 anchor的偏差)的损失

Note:这里的 bbox regression 不同于 Fast RCNN 和 SPPnet的,

  • Fast RCNN 和 SPPnet 的bbox regression: is performed on features pooled from arbitrarily sized RoIs, and the regression weights are shared by all region sizes.

  • Faster RCNN 此处的 bbox regression 是争对 per scales 和 per ratios的,To account for varying sizes, a set of k bounding-box regressors are learned. Each regressor is responsible for one scale and one aspect ratio, and the k regressors do not share weights.

4.1.3 Training RPNs

randomly sampls 256 anchors,这样会出现以下问题:but this will bias towards negative samples as they are dominate,所以我们按照1:1 的抽正负anchors,如果positive anchors不够128,pad negative anchors

We randomly initialize all new layers by drawing weights from a zero-mean Gaussian distribution with standard deviation 0.01.

4.2 Sharing Features for RPN and Fast R-CNN

Both RPN and Fast R-CNN, trained independently, will modify their convolutional layers in different ways. We therefore need to develop a technique that allows for sharing convolutional layers between the two networks, rather than learning two separate networks.

三种训练方法

  • Alternating training(论文中采用的方法)
  • Approximate joint training(效果会比交替训练好一些)
  • Non-approximate joint training

作者用的是 交替训练,4-step Alternating Training

  • RPN(ImageNet 初始化,RPN and Fast RCNN not share prameters)
  • Fast RCNN(ImageNet 初始化,用RPN产生的proposal——替换掉SS产生的,训练Fast RNN,not share)
  • 用上一步的训练好的参数,fine tuning RPN(share)
  • 用重新训练的RPN提出的proposal, fine tuning the unique layers of Fast RCNN 也就是 head 部分(share)

为什么不一二三四,二二三四,换个姿势,再来一次?
A similar alternating training can be run for more iterations, but we have observed negligible improvements.

在这里插入图片描述

收藏 | 目标检测网络学习总结(RCNN --> YOLO V3),

4.3 Implementation Detais

  • Train and test 都是 single scales,reshape shorter side s = 600 pixels

  • Image pyramid : trade off accuracy and speed(没采用)

  • Anchors:scales, 12 8 2 128^2 1282 25 6 2 256^2 2562 51 2 2 512^2 5122,ratios: 1 : 1 1:1 11 2 : 1 2:1 21 1 : 2 1:2 12,见表一,表中红色的字体是预设的 anchors(2:1),表中列出来的是 bbox regression 之后的结果
    这里写图片描述

  • 训练的时候,剔除 cross image boundaries (跨图边界)的anchors,测试的时候,clip(裁剪) to the image

  • RPN proposal 有很多overlap,我们用了非极大值抑制(NMS),iou设置为0.7,NMS does not harm the ultimate detection accuracy,但是减少了 proposal 的数量。论文中 用 top-2000的proposal 进行 train。为什么NMS overlap thresold 设置为0.7呢?

这里写图片描述

看上面这个图,就是 1 : 1 1:1 11 2 : 1 ( 2 : 2 / 2 ) 2:1(\sqrt2:\sqrt2/2) 212 :2 /2 1 : 2 ( 2 / 2 : 2 ) 1:2(\sqrt2/2:\sqrt2) 122 /2:2 三种情况,假如 ground truth 和 1:1一样大,那么与 2 : 1 2:1 21 1 : 2 1:2 12 的 IOU都为 : 2 / 2 :\sqrt2/2 :2 /2,这样的话会导致同一目标产生两种特征图,不利于网络的学习,所以把 IOU设置为0.7,尽量缓解这种情况(只是一种解释哟)

5 Experiments

5.1 Ablation Experiments

这里写图片描述

  • 1,2,3对比,3 更好,the fewer proposals also reduce the region-wise fully-connected layers’ cost(table 5可以看到)
  • 3,4 对比,share 好
  • 3,6 对比,RPN+fast RCNN 比 SS+ Fast RCNN 好,train test 的 proposal 不一样
  • 4,8 对比, NMS 影响不大
  • 7,11差距不算大,9,11差距明显,cls 排序很重要
  • 6,12对比,reg 很重要

5.2 VOC 07/12 实验结果

这里写图片描述

5.3 速度(ms)

这里写图片描述

5.4 recall-to-IoU

这里写图片描述

RPN 的 proposal 从 2000 drops 到 300 效果差不多

5.5 PK (one-stage overfeat)

这里写图片描述

5.6 COCO 上的结果

这里写图片描述

VGG 换成 ResNet, ensemble一下, COCO 2015 object detection 冠军

附录

Q&A

  • Q: 为何有ROI Pooling还要把输入图片resize到固定大小的 MxN
    A: 由于引入ROI Pooling,从原理上说Faster R-CNN确实能够检测任意大小的图片。但是由于在训练的时候需要使用大batch训练网络,而不同大小输入拼 batch 在实现的时候代码较为复杂,而且当时以 Caffe 为代表的第一代深度学习框架也不如Tensorflow和PyTorch灵活,所以作者选择了把输入图片resize到固定大小的800x600。这应该算是历史遗留问题。

参考 一文读懂Faster RCNN

结构图

Note: reshape 是为了softmax操作,softmax操作中,第一维必须是类别数,类别如果是2,object or not,则是 class-agnostic ,如果类别是,比如 VOC 数据集,20+1类, 则是 class-specific

这里写图片描述


补充:从R-CNN到RFBNet,目标检测架构5年演进全盘点
在这里插入图片描述


Anchor

目标检测Anchor是什么?怎么科学设置?人人都能彻底搞懂的Anchor深度解析

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: Faster R-CNN是一种基于区域建议网络(Region Proposal NetworksRPN)的物体检测算法,旨在实现实时物体检测。它通过预测每个区域是否含有物体来生成候选框,并使用卷积神经网络(CNN)来确定候选框中的物体类别。Faster R-CNN在提高检测精度的同时,也显著提高了检测速度。 ### 回答2: 在计算机视觉领域中,目标检测一直是热门研究的方向之一。近年来,基于深度学习的目标检测方法已经取得了显著的进展,并且在许多实际应用中得到了广泛的应用。其中,Faster R-CNN 是一种基于区域建议网络(Region Proposal NetworksRPN)的目标检测方法,在检测准确率和速度之间取得了很好的平衡,能够实现实时目标检测。 Faster R-CNN 的基本框架由两个模块组成:区域建议网络(RPN)和检测模块。RPN 主要负责生成候选目标框,而检测模块则利用这些候选框完成目标检测任务。具体来说,RPN 首先在原始图像上以多个尺度的滑动窗口为基础,使用卷积网络获取特征图。然后,在特征图上应用一个小型网络来预测每个位置是否存在目标,以及每个位置的目标边界框的坐标偏移量。最终,RPN 根据预测得分和位置偏移量来选择一部分具有潜在对象的区域,然后将这些区域作为候选框送入检测模块。 检测模块的主要任务是使用候选框来检测图像中的目标类别和位置。具体来说,该模块首先通过将每个候选框映射回原始图像并使用 RoI Pooling 算法来获取固定大小的特征向量。然后,使用全连接神经网络对这些特征向量进行分类和回归,以获得每个框的目标类别和精确位置。 相比于传统的目标检测方法,Faster R-CNN 具有以下优点:首先,通过使用 RPN 可以自动生成候选框,避免了手动设计和选择的过程;其次,通过共享卷积网络可以大大减少计算量,提高效率;最后,Faster R-CNN 在准确率和速度之间取得了很好的平衡,可以实现实时目标检测。 总之,Faster R-CNN 是一种高效、准确的目标检测方法,是深度学习在计算机视觉领域中的重要应用之一。在未来,随着计算机视觉技术的进一步发展,Faster R-CNN 这类基于深度学习的目标检测方法将会得到更广泛的应用。 ### 回答3: Faster R-CNN是一种结合了深度学习和传统目标检测算法的新型目标检测方法,旨在提高目标检测速度和准确率。Faster R-CNN采用了Region Proposal Network(RPN)来生成候选区域,并通过R-CNN网络对候选区域进行分类和定位。 RPN是一种全卷积神经网络,用于在图像中生成潜在的候选区域。RPN通常在卷积特征图上滑动,对每个位置预测k个候选区域和其对应的置信度得分。这样,对于输入图像,在不同大小和宽高比的Anchor上预测候选框,可以在计算上更有效率。 R-CNN网络利用卷积特征图作为输入,对RPN生成的候选区域进行分类和精确定位。与以前的目标检测方法相比,Faster R-CNN使用了共享卷积特征,使得整个检测网络可以端到端地进行训练和优化,缩短了训练时间,同时也更便于理解和改进。 Faster R-CNN不仅具有较高的准确性,还具有较快的检测速度。在各种基准测试中,Faster R-CNN与其他目标检测算法相比,都取得了优异的性能表现。总之,Faster R-CNN将目标检测引入了一个新的阶段,为实时目标检测提供了一个良好的基础。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值