当前位置:网站首页>Retinanet网络结构详解
Retinanet网络结构详解
2022-07-27 22:36:00 【@BangBang】
1. 概述
Retinanet的论文:Focal Loss for Dense Object Detection
论文2017年发表在CVPR(computer vision and pattern recongnition) ,该论文提出来后 one-stage网络首次超过two-stage网络
One-stage和two-stage网络的区别
- two-stage : 以
Faster RCNN为主的two-stage网络,首先需要通过一个RPN网络去生成我们的Proposal, 然后通过Fast RCNN对我们的目标进行最终的预测,它是分两步的。 - one-stage:以
SSD、YOLO系列为主的,它是一步直接预测出我们最终的结果,但是在这篇论文提出前,one-stage网络的精度都是低于two-stage的,本篇论文提出来之后one-stage网络首次超越two-stage网络。
retinaNet性能指标

从RetinaNet给出的性能参数可以看到,AP (IoU从0.5-0.95的均值)最高达到了40.8%。可以看到同期的one-stage网络YOLOv2 SSD513等他们的AP都是在21~33之间。two-stage网络当时比较主流的Faster-RCNN达到了36.8,很明显与RetinaNet的40.8比起来要低很多。
2. RetinaNet网络的详细结构

RetinaNet网络结构与 FPN的不同
RetinaNet网络结构采取了类似于FPN的网络结构,但与FPN结构有3个不同的地方。
- 第一个不同点: FPN中会使用
C2生成我们的P2,但是在我们的RetinaNet中并没有使用C2生成P2,论文作者给的原因就是P2会占用更多的计算资源(P2的特征图相对于P3~P6会更大些),为了节省资源作者就没有使用P2,而是从C3开始生成P3, BackBone这部分跟FPN比较类似。参考:目标检测FPN(Feature Pyramid Networks)的使用 - 第二个不同点:在
P6这个地方,在FPN中是通过最大池化进行下采样的,这里是通过卷积核3x3,步距为2进行下采样的,得到了我们P6 - 第三个不同点:在FPN中是从
P2~P6,但是在RetinaNet网络中是从P3~P7,P7在P6的基础上通过Relu激活函数以及积核3x3,步距为2进行下采样得到的。
预测特征层采用的scale 和 ratio
在之前博客中讲的FPN,每个预测特征层都使用了一个scale和3个Ratios 即3个anchor, 但是在RetinaNet作者针对每个预测特征层使用了3个scale和3个ratios, 9种不同的anchor.
预测器部分
在之前博客介绍FPN网络时,其实它与我们Faster RCNN是类似的,都是Two-stage网络。首先会通过一个RPN生成Proposal,然后通过Fast RCNN生成最终的预测参数。但是我们RetinaNet是一个One-stage网络直接使用预测器。
针对P3-P7预测特征层,共享一个预测器,预测器的细节部分如下,分为两个分支class subnet 和box subnet分别预测每个目标所属的类别以及针对每个anchor去预测目标边界框回归参数。
class subnet: 首先使用4个3x3的卷积层,每个卷积层后面都跟有Relu激活函数 ,最后接一个3x3卷积层是没有激活函数的,同样它的卷积核大小为3x3,步距为1,c=KA这里的K表示检测目标个数,不包含背景类别的,这里A是在预测特征层上每个位置的anchor个数,这里是9box subnet:同样也是跟4个3x3的卷积层,卷积核大小3x3,步距为1, channel为256,最后接一个3x3卷积层是没有激活函数的,同样它的卷积核大小为3x3,步距为1,它的channel=4A,A对应anchor个数9. 这个与Faster RCNN是不同的,Faster RCNN是对预测特征层上每一个anchor都会针对每个类别去生成一组边界框回归参数,因此它对应的channel=4KA
3. 损失函数
正负样本匹配
- 之前将
Faster RCNN的时候,首先我们会对所有的Anchor进行匹配,将它分为正样本以及负样本,在正样本与负样本中进行采样,在根据采样的样本计算它的损失。 - 在
RetinaNet我们也同样需要匹配正负样本,与Faster RCNN不同的地方主要体现在:首先会将Anchor与GT计算IoU,如果IoU大于0.5的话我们会将它标记为正样本,如果某个anchor与所有的GT都小于0.4,我们将它标记为负样本。IoU在[04,0.5]之间的anchor我们会舍弃掉。
损失函数计算

RetinaNet一个比较核心的知识点就是Focal Loss ,详见博客:Focal Loss详解
- 上面的损失函数分为两部分:
分类损失,回归损失 - Focal Loss的
分类损失计算的是所有正负样本的损失,并除以正样本的个数 回归损失是针对所有正样本计算的,加起来后除以正样本的个数- 分类损失使用的
sigmoid Focal Loss,对于回归损失使用的是L1 Loss
边栏推荐
- 芯片行业常用英文术语最详细总结(图文快速掌握)
- Code random notes_ Hash_ 1002 find common characters
- 《KMP复习 + AC自动机》前传
- Recommend a Hongmeng instant messaging software "fruit chat", which is a bit awesome!!
- Focus on demand flow rather than idle people
- How to smoothly go online after MySQL table splitting?
- SAP各模块优缺点和发展简析
- Rancher2.6 monitoring grafana docking LDAP
- [introduction to C language] zzulioj 1026-1030
- Function related knowledge
猜你喜欢
随机推荐
立即报名 | 云原生技术交流 Meetup 广州站已开启,8 月 6 号与你相遇!
CAP的理解
Six relationships of UML class diagram, the best way to learn and understand
福特SUV版“野马”正式下线,安全、舒适一个不落
Scrollview, tableview nested solutions
为华为打造无美系设备的产线,台积电三星能做到吗?
网络设备硬核技术内幕 防火墙与安全网关篇 (五) 安全双修大法 中
Valued at $36billion! SpaceX, which is about to launch its first manned launch, raised $346million
Jointly create a new chapter in cultural tourism | xinqidian signs a strategic cooperation agreement with Guohua cultural tourism
Syntaxerror resolved: positive argument follows keyword argument
Recommended system - indicators: CTR, CVR
What is the org relationship mitigation strategy of Microsoft edge browser tracking prevention
Logic of automatic reasoning 09 - automatic theorem proving
Postman download and use tutorial
Iperf installation and use
Cross desktop web container evolution
LSB steganography
R language evaluates the relative importance of the predictive factors (variables, characteristics) of the regression model, scales the predictive variables of the regression model, and then construct
Jerry's Bluetooth can only link back to the last device [article]
R language uses ggplot2 visualization: use ggpattern package to add custom stripe patterns, shadows, stripes, or other patterns or textures to the grouped bar graph








![[BuildRelease Management]Parabuild](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)
