Convolution operation and Grouped Convolution

这篇具有很好参考价值的文章主要介绍了Convolution operation and Grouped Convolution。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

filter is not the kernel,but the kernels.that's mean a filter include one or two or more kernels.that's depend the input feature map and the output feature maps. for example, if we have an image, the shape of image is (32,32), has 3 channels,that's RGB.so the input feature maps is (1,3,32,32).the format of input feature maps is (batch_size,in_channels,H_in,W_in),the output feature maps is(batch_size,out_channels,H_out,W_out),there is a formulation for out_H,out_W.

Convolution operation and Grouped Convolution,深度学习,pytorch,神经网络

Convolution operation and Grouped Convolution,深度学习,pytorch,神经网络

p is padding,default is 0. s is stride,default is 1.

so, we get the the Height and Width of output feature map,but how about the output channels?how do we get the output channels from the  input channels.Or,In other words,what's the convolution operation?

first,i'll give the conclusion and explain it later.

so the weight size is (filters, kernels of filter,H_k,W_k),the format of weight vector is (C_out,C_in,H_k,W_k)

that's mean we have C_out filters, and each filter has C_in kernels.if you don't understand, look through this link,it will tell you the specific operations.

as we go deeper into the convolution this dimension of channels increases very rapidly thus increases complexity. The spatial dimensions(means height and weight) have some degree of effect on the complexity but in deeper layers, they are not really the cause of concern. Thus in bigger neural networks, the filter groups will dominate.so,the grouped convolution was proposed,you can access to this link for more details.

you can try this code for validation.

import torch.nn as nn
import torch

# 假设输入特征图的大小为 (batch_size, in_channels, H, W)
batch_size = 1
in_channels = 4
out_channels = 2
H = 6
W = 6

# 定义1x1卷积层,输入通道数为in_channels,输出通道数为out_channels
conv = nn.Conv2d(in_channels, out_channels, kernel_size=1, stride=1, padding=0)

# 对输入特征图进行1x1卷积操作
x = torch.randn(batch_size, in_channels, H, W)
y = conv(x)

# 输入特征图的大小为 (batch_size, in_channels, H, W)
print(x.shape)  # torch.Size([1, 4, 6, 6])
# 输出特征图的大小为 (batch_size, out_channels, H, W)
print(y.size())   # torch.Size([1, 2, 6, 6])
# 获取卷积核的尺寸 (out_channels, in_channels // groups, *kernel_size)
weight_size = conv.weight.size()
print('卷积核的尺寸为:', weight_size)  # torch.Size([2, 4, 1, 1])

check this video for more details.文章来源地址https://www.toymoban.com/news/detail-627160.html

到了这里,关于Convolution operation and Grouped Convolution的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【论文笔记合集】卷积神经网络之深度可分离卷积(Depthwise Separable Convolution)

    本文作者: slience_me 我看的论文地址:MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications 假设输入为D F ×D F ×M,输出为输入为D F ×D F ×N,卷积核为D K ×D K ×M,共有N个卷积核进行卷积操作 下图为标准的卷积过程,每个卷积核对输入的向量进行卷积操作,得到一个

    2024年01月16日
    浏览(29)
  • 深度学习模型部署(六)TensorRT工作流and入门demo

    官方给出的步骤: 总结下来可以分为两大部分: 模型生成:将onnx经过一系列优化,生成tensorrt的engine模型 选择batchsize,选择精度precision,模型转换 模型推理:使用python或者C++进行推理 生成trt模型: 然后就坐等输出模型,我们可以根据log信息看一下tensorRT都干了什么: 得到

    2024年03月13日
    浏览(40)
  • CUDA小白 - NPP(2) - Arithmetic and Logical Operations(1)

    cuda小白 原文链接 NPP GPU架构近些年也有不少的变化,具体的可以参考别的博主的介绍,都比较详细。还有一些cuda中的专有名词的含义,可以参考《详解CUDA的Context、Stream、Warp、SM、SP、Kernel、Block、Grid》 常见的NppStatus,可以看这里。 如有问题,请指出,谢谢 Arithmetic Operati

    2024年02月10日
    浏览(68)
  • CUDA小白 - NPP(2) - Arithmetic and Logical Operations(2)

    cuda小白 原始API链接 NPP GPU架构近些年也有不少的变化,具体的可以参考别的博主的介绍,都比较详细。还有一些cuda中的专有名词的含义,可以参考《详解CUDA的Context、Stream、Warp、SM、SP、Kernel、Block、Grid》 常见的NppStatus,可以看这里。 如有问题,请指出,谢谢 Logical Operati

    2024年02月10日
    浏览(23)
  • Dynamics 365 Finance and Operations 创建你的第一个项目框架

    第一章:浅谈Dynamics CRM开发转Dynamics AX开发的感受与差异 第二章:Dynamics 365 Finance and Operations 虚拟机安装及使用 第三章:Dynamics 365 Finance and Operations 创建你的第一个项目(Visual Studio) 本文为大家介绍如何在Visual Studio中创建Model和Solution。并且让你了解Model和solution的基本概念

    2024年02月06日
    浏览(34)
  • 深入理解深度学习——BERT派生模型:BART(Bidirectional and Auto-Regressive Transformers)

    分类目录:《深入理解深度学习》总目录 UniLM和XLNet都尝试在一定程度上融合BERT的双向编码思想,以及GPT的单向编码思想,同时兼具自编码的语义理解能力和自回归的文本生成能力。由脸书公司提出的BART(Bidirectional and Auto-Regressive Transformers)也是如此,它是一个兼顾上下文

    2024年02月11日
    浏览(27)
  • Packet Tracer - Configure Cisco Routers for Syslog, NTP, and SSH Operations

    配置OSPF MD5身份验证。 配置NTP服务。 设置路由器将消息记录到syslog服务器。 配置R3路由器以支持SSH连接。 在本练习中,您将配置OSPF MD5身份验证以实现安全的路由更新。 NTP服务器是本次活动中主NTP服务器。您需要在NTP服务器和路由器上配置身份验证,并设置路由器允许软件

    2024年02月01日
    浏览(29)
  • 《Effective C++》第三版-2. 构造析构赋值运算(Constructors,Destructors,and Assignment Operators)

    目录 条款05:了解C++默默编写并调用哪些函数(Know what functions C++ silently writes and calls) 自动生成的函数 举例说明 条款06:若不想使用编译器自动生成的函数,就该明确拒绝(Explicitly disallow the use of compiler-generated functions you do not want) 条款07:为多态基类声明virtual析构函数(

    2024年04月28日
    浏览(35)
  • 深度学习 - 51.推荐场景下的 Attention And Multi-Head Attention 简单实现 By Keras

    目录 一.引言 二.计算流程 1.Attention 结构 2.Multi-Head Attention 结构 三.计算实现 1.Item、序列样本生成 2.OwnAttention Layer 实现 2.1 init 初始化 2.2 build 参数构建 2.3 call 逻辑调用 3.OwnAttention Layer 测试 四.总结 Attention And Multi-Head Attention 一文中我们简单介绍了 Attention 与 Multi-Head Attenti

    2024年02月07日
    浏览(39)
  • 深度学习论文分享(一)ByteTrackV2: 2D and 3D Multi-Object T racking by Associating Every Detection Box

    论文原文:https://arxiv.org/pdf/2303.15334.pdf 论文代码:https://github.com/ifzhang/ByteTrack-V2 Title:ByteTrackV2: 2D and 3D Multi-Object Tracking by Associating Every Detection Box Authors:Yifu Zhang, Xinggang Wang, Xiaoqing Y e, Wei Zhang, Jincheng Lu, Xiao T an, Errui Ding, Peize Sun, Jingdong Wang 在此仅做翻译(经过个人调整,有

    2024年02月05日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包