Image classification of RGB images in a Convolutional Neural Network is usually done by feeding the CNN first layer with a Numpy array with dimensions: pixel array by the number of channels. Example: [256 pixels] x [256 pixels] x [3 channels].

What is the impact on performance if applying a different Numpy array in a different order: say [256 pixels] x [3 channels] x [256 pixels], assuming that the CNN first layer structure is changed?

  1. Does the CNN architecture of the sub-sequent layers need to be changed?
  2. Would the model prediction accuracy be impacted?

My use case is a bit different where I have multiple features in a 5 dimensional Numpy Array [X pixels],[Y pixels],[N size],[M size],[L size] and I'm concerned that the order of how the features are entered into the CNN will impact the model training.


1 Answer 1


It shouldn't matter for the accuracy of the network. But note that tensorflow/keras uses the (N, W, H, C) convention whereas pytorch uses the (N, C, W, H). So depending on what library you use, you need to make sure the inputs are shaped correctly before feeding it to the network.

If you are trying to build a nerual network from scratch and training it with numpy, then ideally you would make the spatial dimensions last (..., W, H), to interface with functions such as np.convolve efficiently.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .