Matching image dimensions with numpy arrays

Hello everyone,
I’m a bit confused about the dimensions in the first assignement of convnets, in the assignements the dimensions are as follow (m, n_H, n_W, n_C) but when i did some tests with numpy arrays (see pictures below) it seems like numpy is processing it like this: (m, n_C,n_H, n_W)


This is just a question of how the print statements handle the dimensions. Here’s a thread which shows a better way to understand this.

So, if i understand it’s just a matter of conventions. You can arrange the dimensions in the order you want as long as you respect that order when you’re manipulating the data, is this true? And again if it’s the case, isn’t it more intuitive ( in terms of numpy printing) to use (m,n_C,n_H,n_W)?

Yes, it is a matter of convention whether you put the channels dimension first or last. Which is more intuitive is a matter of taste.

For everything in the courses here, they always use “channels last” mode, so the best idea is to get used to seeing it that way.

1 Like