I'm working with keras cifar10
dataset, which gives me a set of RGB images as numpy array
in the shape (32,32,3)
.
I'm trying to resize that RGB image to (224,224,3), but every time I'm trying to do it with the reshape function
:
test = x_train[0].reshape(224,224,3)
I am getting following error:
ERROR: cannot reshape array of size 3072 into shape (224,224,3)
Does anyone knows how to reshape the RGB images ?
Reshaping an array with shape (32,32,3) into an array with shape (224,224,3) cannot be done using np.reshape since it would require additional data to be created or existing data to be interpolated, which is not how np.reshape works.
If you want to resize an image, use OpenCV:
import cv2
test = cv2.resize(x_train[0], dsize=(224, 224), interpolation=cv2.INTER_CUBIC)