当前位置:网站首页>一点比较有意思的模块
一点比较有意思的模块
2022-06-30 17:34:00 【迪菲赫尔曼】
分享一下自己写的一个模块,我在VOC数据集上测试没有涨点,但是好多人在自己的数据集上都涨点了,那我就简单说下原理
我起初想法很简单,就是觉得原本的 6 × 6 6×6 6×6卷积参数量太大了,然后就想使用一个 3 × 3 3×3 3×3和一个 5 × 5 5×5 5×5的卷积替代,主要目的是想节省一点参数量(虽然微不足道),后来有同学说可以试试空洞卷积,随后我就把 5 × 5 5×5 5×5的普通卷积替换成了 3 × 3 3×3 3×3的空洞卷积,这样可以保持感受野不变的同时进一步减少参数
原理图如下所示,(a)为原始的 6 × 6 6×6 6×6卷积(b)为我自己改进的卷积,我这里没有加BN和SiLU,我测试了一下,加了比不加点数还低,

改进后第一层的参数量确实减少了一半多

源码:
class Inception_Conv(nn.Module):
# Standard convolution
def __init__(self, c1, c2, k=3, s=2, g=1, p=None): # ch_in, ch_out, kernel, stride, padding, groups
super().__init__()
self.conv1 = nn.Conv2d(c1, c2, k, s, autopad(k, p), groups=g, bias=False)
self.conv2 = nn.Conv2d(c1, c2, k , s, autopad(k+2 , p),dilation=2, groups=g, bias=False)
def forward(self, x):
x1 = self.conv1(x)
x2 = self.conv2(x)
x = torch.add(x1, x2)
return x
配置文件:
# YOLOv5 by Ultralytics, GPL-3.0 license
# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
# YOLOv5 v6.0 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Inception_Conv, [64, 3]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, C3, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 6, C3, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, C3, [512]],
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 3, C3, [1024]],
[-1, 1, SPPF, [1024, 5]], # 9
]
# YOLOv5 v6.0 head
head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13
[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
[-1, 1, Conv, [256, 3, 2]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
[-1, 1, Conv, [512, 3, 2]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
]
边栏推荐
- C language structure
- Coding officially entered Tencent conference application market!
- It's not easy to say I love you | use the minimum web API to upload files
- When selecting smart speakers, do you prefer "smart" or "sound quality"? This article gives you the answer
- 【云驻共创】Huawei iConnect使能物联终端一触即联
- Openlayers 卷帘地图
- Deep learning compiler understanding
- 充值满赠,IM+RTC+X 全通信服务「回馈季」开启
- If you want to learn software testing, you must see series, 2022 software testing engineer's career development
- Vscode status bar statusbar
猜你喜欢

教你30分钟快速搭建直播间

【TiDB】TiCDC canal_json的实际应用

countdownlatch 和 completableFuture 和 CyclicBarrier

MySQL advanced - Architecture

It's not easy to say I love you | use the minimum web API to upload files

CODING 正式入驻腾讯会议应用市场!

Volcano engine was selected into the first "panorama of edge computing industry" in China

【合集- 行业解决方案】如何搭建高性能的数据加速与数据编排平台

医院在线问诊小程序源码 互联网医院源码 智慧医院源码

Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain
随机推荐
Teach you to quickly set up a live studio in 30 minutes
PHP uses queues to solve maze problems
Compilation problems and solutions of teamtalk winclient
漏洞复现----38、ThinkPHP5 5.0.23 远程代码执行漏洞
【云驻共创】Huawei iConnect使能物联终端一触即联
Is it safe to open a mobile stock account? Is it reliable?
100 examples of bug records of unity development (the first example) -- shader failure or bug after packaging
教你30分钟快速搭建直播间
SaaS project management system solution for the financial service industry helps enterprises tap a broader growth service space
深度学习编译器的理解
医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视
Glacier teacher's book
MySQL advanced - basic index and seven joins
国内离线安装 Chrome 扩展程序的方法总结
Multipass中文文档-设置图形界面
countdownlatch 和 completableFuture 和 CyclicBarrier
Tensorflow2 深度学习十必知
Redis - persistent RDB and persistent AOF
What if the apple watch fails to power on? Apple watch can not boot solution!
mysql for update 死锁问题排查