卷积知识需要先看:sheng的学习笔记-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此时包括:same,valid和causal。
示例代码
def cnn_model():
from tensorflow import keras
inputs = keras.Input(shape=(34, 1))
net = keras.layers.Conv1D(filters=128, kernel_siz


最低0.47元/天 解锁文章
5023

被折叠的 条评论
为什么被折叠?



