TF1_C1_W3_LAB1 Experiment with convolution layers

Hey, I tried two different models -

  1. 2 convolution layers with a filter of 16
  2. 1 convolution layer with a filter of 32
    However second model gives more accuracy as compared to first one. As per my understanding, more the convolution layers, better the accuracy , so first model should have performed better. Could you please explain the reason behind this?

Also, in the dense layer we usually specify 128 neurons , what is this number, is it always this number or we can change it?

Convolution layers are usually seperated by a max pooling layer. Also, the number of filters increase with model depth. Please try that.

There is no fixed rule on the number of dense units you need to specify except for the output layer.

If you are interested in learning details about neural networks, see deep learning specialization.

Thanks for your response.
I understand that convolution layers are separated by Max Pooling Layer. My query was a model with two convolution layers should perform better than a single convolution layer. However , I didn’t notice the same during experimentation.
Also, if you could explain what does the dense layer unit represent, it would be helpful.

By dense units, I’m referring to the number of units in the tf.keras.layers.Dense layer. For instance, tf.keras.layers.Dense(2) has 2 units.

If you have sufficient number of filters in a single layer, the architecture can work better than having a stack of conv layers. To recall a lecture from Andrew Ng, a single hidden layer NN (Neural Network) with large number of units can perform as well as a NN with a stack of layers. We still prefer the stacked version due to smaller size and better performance.

I’m not aware of any literature that explicitly states the minimum number of filters one must have in a single layer conv NN to outperform a multi-layer conv NN. Please let us know if you come across this information.

With increase in depth, you increase the number of conv filters. This is done to account for the fact that the height and width dimensions of the input are reduced due to valid padding. Do change the 2nd conv dimension to say, 32.