Receptive Field Block Net for Accurate and Fast Object Detection

简介

本文在SSD基础上提出了RFB Module,利用神经科学的先验知识来解释这种效果提升。本质上是设计一种新的结构来提升感受野,并表明了人类视网膜的感受野有一个特点,离视线中心越远,其感受野是越大的,越靠近视线中间,感受野越小。基于此,本文提出的RFB Module就是来模拟人类这种视觉特点的。

RFB Module

结构如下图所示。

为什么要用空洞卷积呢?

首先要提高感受野,直观的想法就是要么加深层数,要么使用更大的卷积核,要么就是卷积之前使用pooling。加深层数网络参数就会变多,没法完成轻量级的任务;更大的卷积核一样参数也会变多;pooling虽然不会增加参数,但是会使信息损失,不利于后面层的信息传递。所以作者这里很自然的想到用空洞卷积,既不增加参数量,又能够提高感受野。

为什么要用这种多分支结构呢?

这是为了捕捉不同感受野的信息,如前面提到的,人类视野的特点就是距视野中心距离不同感受野不同,所以使用多分支结构,每个分支捕捉一种感受野,最后通过concat来融合感受野信息,就能达到模拟人类视觉的效果了。作者这里也给了一张图来说明。

为什么要提出两种版本的RFB呢?

左边的结构是原始的RFB,右边的结构相比RFB把3×3的conv变成了两个1×3和3×1的分支,一是减少了参数量,二是增加了更小的感受野,这样也是在模拟人类视觉系统,捕捉更小的感受野。

网络结构

整体网络结构如下所示,很好理解。

前面就是vgg19,然后从中间的层分出6个预测分支,比较好理解没啥记的。

代码复现

import torch
import torch.nn as nn
import torch.nn.functional as F
from torchsummary import summary
class RFBModule(nn.Module):
def __init__(self,out,stride = 1):
super(RFBModule,self).__init__()
self.s1 = nn.Sequential(
nn.Conv2d(out,out,kernel_size = 1),
nn.Conv2d(out,out,kernel_size=3,dilation = 1,padding = 1,stride = stride)
)
self.s2 = nn.Sequential(
nn.Conv2d(out,out,kernel_size =1),
nn.Conv2d(out,out,kernel_size=3,padding = 1),
nn.Conv2d(out,out,kernel_size=3,dilation = 3,padding = 3,stride = stride)
)
self.s3 = nn.Sequential(
nn.Conv2d(out,out,kernel_size =1),
nn.Conv2d(out,out,kernel_size = 5,padding =2),
nn.Conv2d(out,out,kernel_size=3,dilation=5,padding = 5,stride = stride)
)
self.shortcut = nn.Conv2d(out,out,kernel_size = 1,stride = stride)
self.conv1x1 = nn.Conv2d(out*3,out,kernel_size =1)
def forward(self,x):
s1 = self.s1(x)
s2 = self.s2(x)
s3 = self.s3(x)
#print(s1.size(),s2.size(),s3.size())
mix = torch.cat([s1,s2,s3],dim = 1)
mix = self.conv1x1(mix)
shortcut = self.shortcut(x)
return mix + shortcut
class RFBsModule(nn.Module):
def __init__(self,out,stride = 1):
super(RFBsModule,self).__init__()
self.s1 = nn.Sequential(
nn.Conv2d(out,out,kernel_size = 1),
nn.Conv2d(out,out,kernel_size=3,dilation = 1,padding = 1,stride = stride)
)
self.s2 = nn.Sequential(
nn.Conv2d(out,out,kernel_size =1),
nn.Conv2d(out,out,kernel_size=(1,3),padding = (0,1)),
nn.Conv2d(out,out,kernel_size=3,dilation = 3,padding = 3,stride = stride)
)
self.s3 = nn.Sequential(
nn.Conv2d(out,out,kernel_size =1),
nn.Conv2d(out,out,kernel_size = (3,1),padding =(1,0)),
nn.Conv2d(out,out,kernel_size=3,dilation=3,padding = 3,stride = stride)
)
self.s4 = nn.Sequential(
nn.Conv2d(out,out,kernel_size =1),
nn.Conv2d(out,out,kernel_size=3),
nn.Conv2d(out,out,kernel_size = 3,dilation = 5,stride = stride,padding = 6)
)
self.shortcut = nn.Conv2d(out,out,kernel_size = 1,stride = stride)
self.conv1x1 = nn.Conv2d(out*4,out,kernel_size =1)
def forward(self,x):
s1 = self.s1(x)
s2 = self.s2(x)
s3 = self.s3(x)
s4 = self.s4(x)
#print(s1.size(),s2.size(),s3.size(),s4.size())
#print(s1.size(),s2.size(),s3.size())
mix = torch.cat([s1,s2,s3,s4],dim = 1)
mix = self.conv1x1(mix)
shortcut = self.shortcut(x)
return mix + shortcut class RFBNet(nn.Module):
def __init__(self):
super(RFBNet,self).__init__()
self.feature_1 = nn.Sequential(
nn.Conv2d(3,64,kernel_size = 3,padding = 1),
nn.ReLU(),
nn.Conv2d(64,64,kernel_size=3,padding=1),
nn.ReLU(),
nn.MaxPool2d(kernel_size = 2,stride = 2),
nn.Conv2d(64,128,kernel_size = 3,padding = 1),
nn.ReLU(),
nn.Conv2d(128,128,kernel_size=3,padding=1),
nn.ReLU(),
nn.MaxPool2d(kernel_size = 2,stride = 2),
nn.Conv2d(128,256,kernel_size = 3,padding = 1),
nn.ReLU(),
nn.Conv2d(256,256,kernel_size=3,padding=1),
nn.ReLU(),
nn.Conv2d(256,256,kernel_size=3,padding=1),
nn.ReLU(),
nn.MaxPool2d(kernel_size = 2,stride = 2),
nn.Conv2d(256,512,kernel_size = 3,padding = 1),
nn.ReLU(),
nn.Conv2d(512,512,kernel_size=3,padding=1),
nn.ReLU(),
nn.Conv2d(512,512,kernel_size=3,padding=1),
nn.ReLU(),
) self.feature_2 = nn.Sequential(
nn.MaxPool2d(kernel_size = 2,stride = 2),
nn.Conv2d(512,512,kernel_size = 3,padding = 1),
nn.ReLU(),
nn.Conv2d(512,512,kernel_size=3,padding=1),
nn.ReLU(),
nn.Conv2d(512,512,kernel_size=3,padding=1),
nn.ReLU(),
)
self.pre = nn.Conv2d(512,64,kernel_size = 1)
self.fc = nn.Conv2d(512,64,kernel_size = 1)
self.det1 = RFBsModule(out = 64,stride = 1)
self.det2 = RFBModule(out = 64,stride = 1)
self.det3 = RFBModule(out = 64,stride = 2)
self.det4 = RFBModule(out = 64,stride = 2)
self.det5 = nn.Conv2d(64,64,kernel_size = 3)
self.det6 = nn.Conv2d(64,64,kernel_size=3) def forward(self,x):
x = self.feature_1(x)
det1 = self.det1(self.fc(x))
x = self.feature_2(x)
x = self.pre(x)
det2 = self.det2(x)
det3 = self.det3(det2)
det4 = self.det4(det3)
det5 = self.det5(det4)
det6 = self.det6(det5)
det1 = det1.permute(0,2,3,1).contiguous().view(x.size(0),-1,64)
det2 = det2.permute(0,2,3,1).contiguous().view(x.size(0),-1,64)
det3 = det3.permute(0,2,3,1).contiguous().view(x.size(0),-1,64)
det4 = det4.permute(0,2,3,1).contiguous().view(x.size(0),-1,64)
det5 = det5.permute(0,2,3,1).contiguous().view(x.size(0),-1,64)
det6 = det6.permute(0,2,3,1).contiguous().view(x.size(0),-1,64) return torch.cat([det1,det2,det3,det4,det5,det6],dim = 1) if __name__ == "__main__":
net = RFBNet()
x = torch.randn(2,3,300,300)
summary(net,(3,300,300),device = "cpu")
print(net(x).size())

论文原文:https://arxiv.org/pdf/1711.07767.pdf

[论文理解] Receptive Field Block Net for Accurate and Fast Object Detection的更多相关文章

  1. Paper Reading:Receptive Field Block Net for Accurate and Fast Object Detection

    论文:Receptive Field Block Net for Accurate and Fast Object Detection 发表时间:2018 发表作者:(Beihang Universi ...

  2. Receptive Field Block Net for Accurate and Fast Object Detection

    Receptive Field Block Net for Accurate and Fast Object Detection 作者:Songtao Liu, Di Huang*, and Yunh ...

  3. 论文阅读笔记五十一:CenterNet: Keypoint Triplets for Object Detection(CVPR2019)

    论文链接:https://arxiv.org/abs/1904.08189 github:https://github.com/Duankaiwen/CenterNet 摘要 目标检测中,基于关键点的 ...

  4. [论文理解] Acquisition of Localization Confidence for Accurate Object Detection

    Acquisition of Localization Confidence for Accurate Object Detection Intro 目标检测领域的问题有很多,本文的作者捕捉到了这样一 ...

  5. 论文阅读笔记三十三:Feature Pyramid Networks for Object Detection(FPN CVPR 2017)

    论文源址:https://arxiv.org/abs/1612.03144 代码:https://github.com/jwyang/fpn.pytorch 摘要 特征金字塔是用于不同尺寸目标检测中的 ...

  6. [论文理解] CBAM: Convolutional Block Attention Module

    CBAM: Convolutional Block Attention Module 简介 本文利用attention机制,使得针对网络有了更好的特征表示,这种结构通过支路学习到通道间关系的权重和像素 ...

  7. 【计算机视觉】【神经网络与深度学习】论文阅读笔记:You Only Look Once: Unified, Real-Time Object Detection

    尊重原创,转载请注明:http://blog.csdn.net/tangwei2014 这是继RCNN,fast-RCNN 和 faster-RCNN之后,rbg(Ross Girshick)大神挂名 ...

  8. 论文阅读笔记二十七:Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks(CVPR 2016)

    论文源址:https://arxiv.org/abs/1506.01497 tensorflow代码:https://github.com/endernewton/tf-faster-rcnn 室友对 ...

  9. 机器视觉:Convolutional Neural Networks, Receptive Field and Feature Maps

    CNN 大概是目前 CV 界最火爆的一款模型了,堪比当年的 SVM.从 2012 年到现在,CNN 已经广泛应用于CV的各个领域,从最初的 classification,到现在的semantic se ...

随机推荐

  1. echarts图表数据信息动态获取

    第一步准备一个json文件echarts.json(名字无所谓),用来模拟从后台获取数据 { "name":["直达","营销广告",&qu ...

  2. vue-resource 全局拦截器

    项目中可能会添加超时登录的功能,因此根据tokenid 判断是否超时.如果token已过期,需要跳转至登录页面. 因此需要用到全局拦截器拦截返回的状态 //下边代码添加在main.js中 Vue.ht ...

  3. 在Chrome中使用IE浏览器!

    学校的毕业论文系统,无法完整显示网页,特别是下部的"提交"按钮看不见. IE11无效. 发现"360极速浏览器 7.5.3.186"能正常显示,百度网盘下载太慢 ...

  4. NativeScript —— 初级入门(跨平台的手机APP应用)《二》

    NativeScript项目结构 根文件夹 package.json —— 这是适用于整个应用程序的NativeScript主项目配置文件. 它基本概述了项目的基本信息和所有平台要求. 当您添加和删除 ...

  5. PyCharm上unittest 测试用例两种执行方式

    每次讲到unittest测试框架的时候,经常有同学在群里反映,为啥我的运行不是按照我往suite里添加的用例顺序执行的,为什么别人的能跑出来报告,我的就不行... 当然,首先确认代码是OK的,如果代码 ...

  6. 模拟赛小结:2017 China Collegiate Programming Contest Final (CCPC-Final 2017)

    比赛链接:传送门 前期大顺风,2:30金区中游.后期开题乏力,掉到银尾.4:59绝杀I,但罚时太高卡在银首. Problem A - Dogs and Cages 00:09:45 (+) Solve ...

  7. IDEA Debug模式下启动慢的解决办法

    工程没有做什么大的改动,近期Idea在debug模式下启动耗时800s +,run模式下200s.Idea debug模式启动的时候会有这样的提示: 方法断点会戏剧性的降低debug的速度.当时并没有 ...

  8. java8学习之内部迭代与外部迭代本质剖析及流本源分析

    关于Stream在Java8中是占非常主要的地位的,所以这次对它进行进一步探讨[这次基本上都是偏理论的东东,但是理解它很重要~],其实流跟咱们数据库学习当中的sql语句的特点是非常非常之像的,为什么这 ...

  9. vim简明教程(附快速记忆方法)

    vim分为四种模式: 普通模式(normal mode) 插入模式(insert mode) 可视模式(visual mode) 命令模式(excute mode) 下面整理了常用的快捷键和记忆方法( ...

  10. 【洛谷P4552】IncDec Sequence

    题目大意:给定一个长度为 N 的序列,现可以进行若干次区间 +1 或区间 -1 操作,求使得序列所有的值均相同的最小操作数是多少,且最终得到的序列有多少种. 题解: 首先考虑执行区间+和区间-操作,可 ...