Issue
I'm working wirth keras "cifar10" dataset, which gives you 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 try to do it with the reshape function, the following error shows up:
test = x_train[0].reshape(224,224,3)
EROR: cannot reshape array of size 3072 into shape (224,224,3)
Does anyone knows how to resize bigger my RGB images?
Solution
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)
Answered By - Sup3rlum
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.