This may be a wrong question or something so feel free to correct me :).

I have been studying neural networks for weeks now. I came across the multi-class classification model that uses neural networks.

enter image description here

As we see in this picture, the model allows you to classify your input into different classes. But this also assumes your input always use the same number features, right ? Meaning if I want to recognize handwritten digits, I should have images with the same dimension (for example 24x24) so I can use the same number of features (in this case 24x24=576). But what if one class, for example number 6, requires a different number of features (like the dimension of the handwritten digit 6 is 30x30 pixels)

  • I know that the logical way to do this, is to have two different neural networks, but Is there any way to simultaneously train a multi-class classification model where inputs might use different features? What does research say about this?

PS: If you have good reading materials about this, please feel free to link them too.



1 Answer 1


It is essential for all input patterns to have the same number of features. The reason is that each input feature is connected to specified neurons and they have specified trained weights. A typical solution is to resize your input by reserving its aspect ratio. You should consider that if you want to have good accuracy, you have to have such an operation while training the network too. Even in convolutional networks, it is essential to have the same input size. Although the convolutional layers won't bother you, the connection of fully connected layers and flattened layers used after convolutional layers will have a problem if you don't use correct input shape; the dimensions won't match.

About recent studies, I have not seen yet, but a typical solution can be employing PCA and using let's say its top-10 features as the input of a fully connected network, although for input patterns with a huge difference in the number of input dimensions I guess it is not logical.

  • $\begingroup$ What does PCA mean ? Also, some friend said that convolutional neural network are known to be flexible. do you think they are interesting for this case? $\endgroup$
    – U. User
    Oct 27, 2018 at 10:30
  • $\begingroup$ PCA stands for principal component analysis. As I've referred, CNNs' input also should be of the same size due to the connection of convolutional layers and dense layers. $\endgroup$ Oct 27, 2018 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.