sheng的学习笔记-TCN时序卷积:因果卷积、空洞卷积

卷积知识需要先看:sheng的学习笔记-AI-卷积神经网络

时序模型需要先看: sheng的学习笔记-AI-序列模型

Ai目录:sheng的学习笔记-AI目录-优快云博客

在时序模型rnn中也可以使用卷积,此笔记记录这部分卷积内容

基础知识

什么是TCN 时序卷积 (temporal convolutional network)

TCN全称Temporal Convolutional Network,时序卷积网络,是在2018年提出的一个卷积模型,但是可以用来处理时间序列。

二维卷积 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中一种

一维卷积Conv1D

  • 输入变为三维变量
  • padding此时包括:samevalid 和causal

示例代码

def cnn_model():
    from tensorflow import keras

    inputs = keras.Input(shape=(34, 1))
    net = keras.layers.Conv1D(filters=128, kernel_siz
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值