• 分组卷积和深度可分离卷积


    分组卷积的由来

    分组卷积最早开始于AlexNet,主要为了解决单个GPU无法处理含有大量计算量和存储需求的卷积层这个问题。目前,分组卷积多被用于构建用于移动设备的轻量级网络模型。例如深度可分离卷积。

     pytorch中的使用方法

    Conv2d(in_channels, out_channels, kernel_size, stride=1,padding=0, dilation=1, groups=1,bias=True, padding_mode=‘zeros’)
    Args:
        in_channels (int): Number of channels in the input image
        out_channels (int): Number of channels produced by the convolution
        kernel_size (int or tuple): Size of the convolving kernel
        stride (int or tuple, optional): Stride of the convolution. Default: 1
        padding (int, tuple or str, optional): Padding added to all four sides of
            the input. Default: 0
        padding_mode (string, optional): ``'zeros'``, ``'reflect'``,
            ``'replicate'`` or ``'circular'``. Default: ``'zeros'``
        dilation (int or tuple, optional): Spacing between kernel elements. Default: 1
        groups (int, optional): Number of blocked connections from input
            channels to output channels. Default: 1
        bias (bool, optional): If ``True``, adds a learnable bias to the
            output. Default: ``True``

    卷积参数量的计算公式是:(输入通道数 * 输出通道数 * k^2 )/ groups

    常规卷积

    分两组时

    分四组时

    以上都是均匀分组。每个组内部和常规卷积一样,组间的特征图不可见。分组卷积可以减少参数量。

    深度可分离卷积

    深度可分离卷积可以分为深度卷积和逐点卷积。

    深度卷积

    深度卷积其实就是一种特殊的分组卷积,它的组数等于输入的特征数,即每一组都只有一个卷积核。

    Depthwise Convolution完成后的Feature map数量与输入层的depth相同,但是这种运算对输入层的每个channel独立进行卷积运算后就结束了,没有有效的利用不同map在相同空间位置上的信息。因此需要增加另外一步操作来将这些map进行组合生成新的Feature map,即接下来的Pointwise Convolution

    逐点卷积

    逐点卷积就是卷积核大小为1*1的卷积核。

    参考文献:

    分组卷积和深度可分离卷积 - 颀周 - 博客园 (cnblogs.com)

    卷积神经网络中的Separable Convolution (yinguobing.com)

  • 相关阅读:
    2024全国水科技大会暨新能源及电子行业废水论坛(十一)
    一个基于.NET Core构建的简单、跨平台、模块化的商城系统
    OSPF —— 优化配置
    【Qt6】列表模型——几个便捷的列表类型
    第十六章 Redies
    光学镜头参数之—分辨率
    理解JS的三座大山
    RFM模型
    最优装载-贪心算法
    【Verilog】组合逻辑电路 -- 程序设计及应用
  • 原文地址:https://blog.csdn.net/qq_40107571/article/details/125883523