Fundamental questions on CNN and MLP in general I have read a number of tutorials and online lectures (link1: https://ujjwalkarn.me/2016/08/11/intuitive-explanation-convnets/) and link2: the webtutorial: http://cs231n.github.io/convolutional-networks/#overview
 but none of them mention the rationale for selecting a particular design. How do we decide on the following design aspects?
In particular the following points are unclear to me and shall be extremely grateful if somebody could walk through the concepts that will help me to design any CNN architecture.
1) If the filter size is 5*5*3 then how come the number of filters, $K=12$? Shouldn't it be 3 -- one for each channel?
2) In the second link, there is a formula   -  $((W-F+2P)/S)+1$
where $W$ = width of the input image, $F$ = filter size. It is not clear what is the purpose of this formula
3) Is there a rule of thumb/formula for deciding on the number of layers, number of filters, filter size, number of fully connected layers?  Or is it purely on the basis of trial and error?
4) Can somebody please explain the intuition and the rationale for designing a CNN architecture for this example -- considering a binary classification problem. For an input RGB image of size 500*500*3, how would you design the architecture -- how many layers, number of filters, size of the filter, how much is the stride, etc. 
 A: *

*I'm not sure where you found the $5 \times 5 \times 3$. Maybe it's the size of the input image. In that case the input image does have 3 channels, but we can select how many filters we want the layer to have arbitrarily. Let's say we select $K=12$ filters. Then the output of this layer will have $12$ filters. This way, the next layer will see $12$ channels as its input.

*This formula is used to calculate the number of parameters a convolutional layer will have.

*No unfortunately there is no such rule of the thumb. Also the well established state-of-the-art networks don't follow any sort of architecture (e.g. see inception, resnet, vgg. They are all very different architecturally). If you want to create your own I'd suggest taking an established network (e.g. ResNet-50 and tweaking it out a bit).

*Same as before. One thing you could try to do is follow the pretty basic scheme of [conv (+relu) -> conv (+relu) -> max pool] repeat this 2-3 times -> flatten -> fc (+relu) -> dropout -> fc (2 neurons and softmax activation). This, is a decent model which doesn't take much memory and runs relatively fast (compared to more complex CNNs), but can't reach state of the art performance. If you want better results stick with fine-tuning a pre-trained state-of-the-art model.
