I am trying to understand how to use np.transpose() properly.
I have a np array of shape (4,28,28,8,8)
. So this is 4 images of shape (224,224)
that I viewed as shown by the previous shape.
I would like to revert back to (4,224,224)
. I feel the best way to go about is to use np.transpose() and reshape() functions. But I am hitting a roadblock as to how to revert back correctly.
Help. Please and thank you.
EDIT: (4,224,224) is 4 (this variable is subject to change as the number of images I load can change it can be 4, it can be 1000) images of shape (224,224). I used listdir() to load images. While loading I resized to the current shape of (224,224). I am going to perform operations on the shape (4,28,28,8,8) which is technically, 4 images, of shape (224,224) broken into (28,28) blocks, each containing (8,8) blocks. This shape I got by using view_as_blocks provided by scikit-image. Once I perform the operations which require that shape, I must revert back to (4,224,224). Where I am stuck.