当前位置:网站首页>分组卷积(Group Converlution)
分组卷积(Group Converlution)
2022-07-26 19:44:00 【我是一个对称矩阵】
0、前言
首先看普通卷积,用pytorch定义为:
nn.Conv2d(in_channels=3,
out_channels=4,
kernel_size=3)

它可以抽象表示为,堆叠体就是一个卷积核,和上图是对应的:
1、组卷积
分组卷积鼎鼎大名,不多介绍了,首先从下图来看下普通卷积和分组卷积的区别(左图是普通卷积,右图是分组卷积)
无论哪一种卷积,输入特征图都是12通道,输入通道图都是6通道,只不过中间运算过程不一样。
图中画的小堆叠块每一个就是一个卷积核,比如普通卷积,输入是12通道,那么一个卷积核的尺寸就是(12,k_size,k_size),这样一个卷积核和输入做运算得到一个特征图。我们要的是6输出通道,所以总共有6个这样的卷积核,总尺寸就是(6,12,k_size,k_size)。

实际上无论普通卷积还是分组卷积,卷积核的数量是没有变的,只不过分组卷积的卷积核的尺寸变小了。
可以认为分组卷积就是把普通卷积的每个卷积核砍掉了,砍成小卷积核了。
比如深度可分离卷积中的depthwise卷积,就是组数=输入通道=输出通道的分组卷积,把本来(3,3,3)的卷积核砍成(1,3,3),也即是把每个3通道的卷积核砍成1通道的卷积核,但是卷积核的数量还是3个。
2、Pytorch的实现
pytorch中conv2的提供了group参数,需要注意的是,从上上图可以看出,分组卷积是将输入特征图和输出特征图都分成了n组,也就是输出通道数和输入通道数都要能被分为n组,否则就要报错。
对于上上图的分组我们使用pytorch实现:
nn.Conv2d(in_channels=12,
out_channels=6,
kernel_size=3,
groups=3)
对于上图(depthwise卷积),我们使用pytorch实现:
nn.Conv2d(in_channels=3,
out_channels=3,
kernel_size=3,
groups=3)
实际上depthwise卷积就是分组数=输入通道数=输出通道数的特殊分组卷积
参考
边栏推荐
- I hope some suggestions on SQL optimization can help you who are tortured by SQL like me
- Using questpdf operation to generate PDF is faster and more efficient!
- Exchange 2010 SSL certificate installation document
- Software testing - development test content specification (project test template)
- 医疗直播平台需要什么功能
- Silent desktop fan chip dltap703sd Jericho
- vs如何读取mysql中的数据(顺便通过代码解决了中文乱码问题)
- What functions does the medical live broadcast platform need
- How to build a super interface collaboration platform: count the six weapons of apifox
- three. Two methods of making Earth annotation with JS
猜你喜欢

YGG 与 AMGI 的旗舰 NFT 项目 My Pet Hooligan 合作进入 The Rabbit Hole

I hope some suggestions on SQL optimization can help you who are tortured by SQL like me

URL format

任务二 kaggle糖尿病检测

Software testing - development test content specification (project test template)

Intranet penetration learning (II) information collection

7岁男童因下棋太快?机器人竟夹断其手指

消息队列知识点总结

AI 技术,让复杂世界简单化 | TeaTalk·Online 应用实战系列第 2 期

解决AttributeError: module ‘win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9‘ has no attribu
随机推荐
tf.GraphKeys
一层节点训练5个坐标的超简单神经网络代码
Summary of message queue knowledge points
Pandonia spirit voxedit creation competition
cv2.resize()
Three implementation methods of C # client program calling external program
「企业管理」精诚CRM+——一体化管理企业业务流程
Kotlin - 协程构建器 CoroutineBuilder
The first training course was a perfect success (๑ㅂ•) و*
Vite 配置 Eslint 规范代码
PSPICE 仿真石英晶体振荡电路
The typing competition is over!
一维数组定义与使用
【刷题记录】22. 括号生成
2000 words to help you master anti shake and throttling
Ue5 editor slate quick start [opening]
There is an Oolong incident in open source. Maybe you don't know these five open source protocols
URL格式
静音台式风扇芯片-DLTAP703SD-杰力科创
本机号码一键登录原理与应用(荣耀典藏版)