How to calculate the number of weights for a CNN?
Each receptive field of a filter has a weight. Furthermore, the whole filter has a single bias.
This gives for a single filter:
2*2*1+1 = 5 weights per filter.
5 filters * 5 weights = 25 weights for all filters.
The conv layer produces shape (4, 4, 5) if we assume the stride is 1.
The fully connected output layer (dense layer) has 5 neurons. Each of them is connected to the output of the conv layer.
So it's (4*4*5) * 5 neurons = 400 connections. Each of these connections has a weight. Each neuron in the dense layer also has a bias, so there are 5 more weights.
To sum up: 25 parameters for conv layer, 405 parameters for dense layer. 430 in total.