Why are the images flattened column wise?

The image dataset undergoes some pre-processing to become a column vector so that it can be inputted. Why are they not processed into a row vector and inputted instead?

Either row or column vectors may be used. There is little standardization in how the data set is organized.

2 Likes

Sometimes while using the lib we have to follow its way of using and accepting things, ways in which a particular lib expects the data to be, so its better to make it a habit from the start to deal with the data in that format.

For example, TensorFlow typically uses channel-last format (height, width, channels), while PyTorch often uses channel-first format (channels, height, width).
When flattening, these conventions can influence whether you choose row-wise or column-wise flattening.

like h x w x c is 4 x 4x 3 becomes 16 x 3 (column wise)
and c x h x w is 3 x 4 x 4 becomes 3 x 16 (row wise)

2 Likes