Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Channels first vs Channels last - what do these mean?

https://software.intel.com/en-us/forums/computer-vision/topic/785538

"The problem has been resolved. It's because the model I use uses channels_first as default for GPU training, while OPENVINO requires channels_last for TF models."

What do these mean?

How can I change them?

I cannot find any further references to this on the net.

like image 652
Simon Kiely Avatar asked Oct 22 '25 17:10

Simon Kiely


2 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.

like image 149
Timbus Calin Avatar answered Oct 24 '25 10:10

Timbus Calin


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

like image 38
Dmitry Avatar answered Oct 24 '25 11:10

Dmitry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!