The Activation
layer in Keras does not have any trainable parameters, which is why you see 0
in the Param #
column for this layer in the model summary.
The Activation
layer is used to apply an activation function to the output of the previous layer. It does not have weights or biases because it does not transform the data in a way that depends on the specific data points in the training set. Instead, it applies a fixed mathematical function (in this case, the ReLU function) to the input data. This is why it does not have any parameters to learn during training.
Here’s what each layer in your model does:
-
Conv2D
: This is a convolutional layer. It applies a convolution operation to the input, passing the result to the next layer. It has trainable weights and biases. -
BatchNormalization
: This layer normalizes the activations of the previous layer, reducing the amount by which the hidden unit values shift around (covariate shift). It has trainable parameters (gamma and beta). -
Activation('relu')
: This layer applies the ReLU activation function to the output of the previous layer. It does not have any trainable parameters. -
MaxPool2D
: This layer applies max pooling to the input, reducing its dimensionality. It does not have any trainable parameters. -
Dropout
: This layer applies dropout to the input, setting a fraction of the input units to 0 at each update during training time, which helps prevent overfitting. It does not have any trainable parameters. -
Flatten
: This layer flattens the input, does not have any trainable parameters. -
Dense
: This is a fully connected layer. It has trainable weights and biases.
So, the Activation
layer has 0
parameters because it does not learn any weights or biases during training. It simply applies the ReLU function to its input.