Keras Conv1d Detailed parameters and input and output

Conv1d(in_channels,out_channels,kernel_size,stride=1,padding=0,dilation=1,groups=1,bias=True)

  • filters: the number of the convolution kernel (i.e., output dimensions)
  • kernel_size: integer or integers composed of a single list / tuple, or spatial domain convolution window length
  • strides: integer or list / tuple consisting of a single integer, for the convolution step. Not any strides 1 are not any dilation_rata 1 is not compatible
  • padding: 0 up policy as "valid", "same" or "casual", "casual" The cause and effect (expansion) convolution, i.e., output [t] is not dependent on input [t + 1:]. Useful when modeling for timing signals can not be in violation of the order of events. "Valid" only effective representatives of convolution, that is not the boundary data processing. "Same" represents the result of the convolution reservations at the boundary, usually results in the same output shape of the input shape.
  • activation: the activation function, predefined activation function name, or element-wise Theano function. Without this function, will not use any activation function (i.e. using a linear activation function: a (x) = x)

 

model.add(Conv1D(filters=nn_params["input_filters"],
                     kernel_size=nn_params["filter_length"],
                     strides=1,
                     padding='valid',
                     activation=nn_params["activation"],
                     kernel_regularizer=l2(nn_params["reg"])))

Example: input dimension (None, 1000,4)

  The first dimension: None

  第二维度:output_length = int((input_length - nn_params["filter_length"] + 1))

       In this case: output_length = (1000 + 2 * padding - filters +1) / strides = (1000 + 2 * 0 -32 +1) / 1 = 969

  The third dimension: filters 

 

Guess you like

Origin www.cnblogs.com/siyuan1998/p/11267522.html