且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

卷积神经网络Conv1d输入形状

更新时间:2023-12-02 18:54:34

@Marcin的答案可能有用,但根据此处的文档可能会提出建议:

@Marcin's answer might work, but might suggestion given the documentation here:

在将此层用作模型的第一层时,请提供一个 input_shape参数(整数或无的元组,例如(10,128) 128维向量的10个向量的序列,或者(无,128) 128维向量的可变长度序列.

When using this layer as the first layer in a model, provide an input_shape argument (tuple of integers or None, e.g. (10, 128) for sequences of 10 vectors of 128-dimensional vectors, or (None, 128) for variable-length sequences of 128-dimensional vectors.

将是:

model = Sequential()
model.add(Conv1D(filters=1, kernel_size=10 ,strides=10,     
                  input_shape=(None, N_features),kernel_initializer= 'uniform',      
                  activation= 'relu')) 

请注意,由于输入数据(N_Data,N_features),我们将示例数设置为未指定(无).在这种情况下,strides参数控制时间步的大小.

Note that since input data (N_Data, N_features), we set the number of examples as unspecified (None). The strides argument controls the size of of the timesteps in this case.