As I've been introducing myself to the various deep learning frameworks, I've noticed a difference in the default placement of channels for images. Is there a substantial difference between NCHW vs NHCW layout? Why would I choose one over the other?
1 Answer
The only difference is when you need to carry out certain operations across the channel axis such as BatchNormalisation
. If you look at https://keras.io/layers/normalization/, one of the parameters for batch normalisation is as such:
axis: Integer, the axis that should be normalized (typically the features axis). For instance, after a Conv2D layer with data_format="channels_first", set axis=1 in BatchNormalization
You need to provide the axis as the model needs to know to carry out normalisation across which axis. Other than that, it doesn't make a difference in training.