Where in the model to apply dropout layers?

My CNN model overfits. It includes some convolutional , maxpooling, flatten and dense layers.
I wonder if I should be using some regularisation, like a dropout layer - is there some general advice where should it go?
should it go after the convolutional layers, for example, or after the flatten layer(s)?

e.g.

Conv2D (…)
Conv2D (…)
MaxPooling2D
Conv2D (…)
MaxPooling2D(…)
Flatten(…)
Dense(…)
Dense(…, activation = ‘softmax’) # sigmoid for binary or softmax for multiclass

Thank you.

The intuition behind it is to use dropout when the number of neurons (consequently parameters -weights) becomes large, so to remove some of them and their effect on computations. So I think whenever you see that there are plenty you can use dropout.

Hi, @bluetail!

Just as quick addition to @gent.spah 's answer, dropout is one of the many existing regularization methods. In my experience, it is outperformed by batch normalization (Ioffe & Szegedy) in a lot of scenarios, but they can be even combined in the same network.