Can the same input for a plain neural network be used for CNNs? Or does the input matrix need to be structured in a different way for CNNs compared to regular NNs?
Can the same input for a plain neural network be used for a convolutional neural network?
There is no restriction on how you input a data to a NN. You can input it in 1D arrays and do element-wise multiplication using 4-5 loops and imposing certain conditions(which will be slow and hence $nD$ matrix notations are used for a CNN). Ultimately, the library you are using (TensorFlow, NumPy might convert it into its own convenient dimensions). The main thing different of a CNN from a normal NN is:
- The number of parameters of a CNN in a convolutional layer is less than the number of input features. $parameters \le features$ (in general it is less than).
Different people have different ways of viewing how the convolutional layer work but the general consensus is that the weights of the convolutional layers of a CNN are like digital filters. It will be a $nD$ filter if input dimension is $nD$. The output is obtained by superimposing the filter on a certain part of the input and doing element-wise multiplication of the values of filter and the values of the input upon which the filter is superimposed upon. How you implement this particular operation depends on you.
So the answer to your question will be same network cannot be used, but it might be used with modifications (a normal NN is the limiting case of a CNN where $features=parameters$.
$\begingroup$ What does parameters mean here? The weights and bias? $\endgroup$ Dec 3, 2018 at 14:59
$\begingroup$ @Iamanon yes. Optimizable variables. $\endgroup$– user9947Dec 3, 2018 at 15:49
$\begingroup$ "So the answer to your question will be same network cannot be used, but it might be used with modifications (a normal NN is the limiting case of a CNN where features=parameters." I've never thought about it this way. This is an interesting conclusion. $\endgroup$ Dec 3, 2018 at 15:53
$\begingroup$ @Iamanon in pretty much every beginner tutorial you would see they use a NN with 784 connections for the MNIST dataset with 784 pixels which means that a NN can be thought of a cnn with filter size same as input $\endgroup$– user9947Dec 3, 2018 at 16:12
- Neural networks generally deal with 1 D data. For example, the data for a NN would be ( 10 , 12 ) , where 10 is the number of samples.
- Convolutional neural networks generally deal with 1D, 2D and 3D data. For example, a 2D CNN would have input as shape ( 10 , 28 , 28 , 3 ) where 10 is the number of samples and ( 28 , 28 , 3 ) is the image size. ( if the input is a image )