TensorFlow:conv1d 滤波器的通道数

数据挖掘 机器学习 Python 神经网络 深度学习 张量流
2021-10-14 17:14:09

我想对ConvNet从 13 个传感器检索到的一维数据应用 a。所以,我的每个样本都包含 13 个通道(51 个值)

我正在使用“conv1d”在我的数据上应用 ConvNet。该网络运行良好,但我想知道“conv1d”如何确定其过滤器的通道数......据我所知,过滤器应该具有与其输入数据相同数量的通道,这使其成为5x13筛选。我将过滤器的宽度设置为 5,但不需要在任何地方设置通道数。

我的问题是:“conv1”层如何确定它的通道数?

以下是我的部分代码:

# We have 13 1D channels of 51 points each

# Note that we've indicated -1 for batch size, which specifies that this dimension should be dynamically computed 
# based on the number of input values in features["x"], holding the size of all other dimensions constant.

input_layer = tf.reshape(features["x"], [-1, 51, 13])

# Convolutional Layer #1
# Shouldn't this filter also need to number of channels? 
This should match the input number of channels
conv1 = tf.layers.conv1d(inputs=input_layer, filters=32, kernel_size=5, padding="same", activation=tf.nn.relu)

# Pooling Layer #1
pool1 = tf.layers.max_pooling1d(inputs=conv1, pool_size=2, strides=2)
1个回答

其中TensorFlow有不同的卷积层。Conv1d,Conv2dConv3d. 第一个用于声音等一维信号,第二个用于图像,灰度或RGB图像,两种情况都被认为是二维信号。最后一个用于视频帧、图像等三维信号,因为二维信号随时间变化。在您的情况下Conv1d用作一维信号,您可以在方法的参数中指定过滤器的数量。你可以看看这里这里