Channels first vs Channels last - what do these mean?

Viewed 7902
3 Answers

Channels first means that in a specific tensor (consider a photo), you would have (Number_Of_Channels, Height , Width).

Channels last means channels are on the last position in a tensor(n-dimensional array).

Examples:

    (3,360,720) --- Channels first

    (360,720,3) --- Channels last

where 3 comes from RGB (coloured image).

TensorFlow has by default channels last setting in the configuration.

The issue comes from the fact that some obsolete now frameworks(such as Theano) had a channels-first approach; porting was a problem particularly for newbies.

The solution to your problem would be to re-train your model in "Channels_Last" format.

You can convert TF model with NCHW layout to IR by using --disable_nhwc_to_nchw with Model Optimizer.

NCHW - channel first
NHWC - channel last

N:batch_size, C:no.of.channels, H:input_img_height, W:input_img_width

by default MKLDNN-plugin uses NCHW data layout.

Related