【卷积】分类:因果、depthwise、pointwise、空洞、转置卷积等

本文详细解析了一维和二维卷积的区别,涵盖因果卷积、空洞卷积、DepthwiseConv2D、PointwiseConvolution和SeparableConv2D等概念。了解如何区分各种类型的卷积,包括单通道与多通道、单核与多核,以及Depthwise的特殊性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

常见的卷积有:因果、depthwise、pointwise、空洞、转置卷积等,如何区分它们呢?

首先卷积可以分为一维卷积和二维卷积

  • Conv1D
  • Conv2D

还可包括

  • Conv1DTranspose, Conv2DTranspose
  • SeparableConv1D, SeparableConv2D

Conv1D

因果卷积

padding=causal

注:Conv2D的padding只有same和valid,没有causal,所以只有一维因果卷积。

空洞卷积

dilation_rate>1

因果空洞卷积

padding=causal
dilation_rate>1

SeparableConv1D

继承自SeparableConv:

Depthwise separable 1D convolution:This layer performs a depthwise convolution that acts separately on channels, followed by a pointwise convolution that mixes channels.

Conv2D

  • 输入参数:指需要做卷积的输入图像/音频等,它要求是一个Tensor,具有[batch, in_height, in_width, in_channels]这样的shape,具体图片的含义是[训练时一个batch的图片数量, 图片高度, 图片宽度, 图像通道数],注意这是一个4维的Tensor,要求类型为float32和float64其中之一。

主要参数包括:

  • filters卷积核个数,也是输出通道数。Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution).
  • kernel_size: 卷积核大小,指定二维卷积窗口的高和宽,(如果kernel_size只有一个整数,代表宽和高相等):An integer or tuple/list of 2 integers, specifying the height and width of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensions.
  • strides: 卷积步长,指定卷积窗沿高和宽方向的每次移动步长,An integer or tuple/list of 2 integers, (如果strides只有一个整数,代表沿着宽和高方向的步长相等) specifying the strides of the convolution along the height and width. Can be a single integer to specify the same value for all spatial dimensions. Specifying any stride value != 1 is incompatible with specifying any dilation_rate value != 1.
  • padding: 为valid或same中一种, one of "valid" or "same" (case-insensitive).

单通道与多通道 卷积

in_channels:

  • in_channels=1:单通道卷积
  • in_channels>1:多通道卷积

单卷积核与多卷积核 卷积

卷积核个数filters

  • filters>1:多卷积核卷积
  • filters=1:单卷积核卷积

DepthwiseConv2D

DepthwiseConv2D继承Conv2D,但是没有filters参数,即默认filters=in_channels>1(多通道卷积)

Pointwise Convolution

kernel_size=[1, 1]
filters>1

SeparableConv2D

继承自SeparableConv

Depthwise Separable Convolution,即 Depthwise Convolution + Pointwise Convolution

空洞卷积

也叫膨胀卷积、扩张卷积,即dilated Conv:

dialation_rate > 1

一维二维卷积均可进行空洞卷积。

Conv2DTranspose

继承自Conv2D。

Transposed convolution layer (sometimes called Deconvolution)

转置卷积,也叫反卷积。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值