1
$\begingroup$

Let's say that I have image data with shape $(32, 32, 3)$ and $50000$

  1. If I would like to reshape it to $(50000, 3, 32, 32)$ what should I do?

I tried np.transpose(0, 3, 1, 2) but it failed.

  1. If I would like to print the number $3$ from $(50000, 3, 32, 32)$ what should I do?
$\endgroup$

1 Answer 1

1
$\begingroup$

If image is a numpy object:

image = image.reshape((50000,3,32,32))

and then print:

print(image[:,3,:,:])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.