I want to change the ordering of this numpy images array to channel_last training_data : (2387, 1, 350, 350) to (2387,350,350,1) validation_data : (298, 1, 350, 350) to (298, 350, 350, 1) testing_data : (301, 1, 350, 350) to (301, 350, 350, 1)
I tried this but it is not working
np.rollaxis(training_data,0,3).shape
np.rollaxis(validation_data,0,3).shape
np.rollaxis(testing_data,0,3).shape
You need the np.transpose
method like this:
training_data = np.transpose(training_data, (0,2,3,1))
The same can be done for the other ones
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With