ValueError: cannot reshape array of size 198266880 into shape (16135,32,32,1)

Viewed 27

I would implementing the ImageDataGenerator to SVM from Sklearn. But i not understand about reshape the array .

print('Train', X_train.shape, y_train.shape)
print('Validation', X_test.shape, y_test.shape)
output:
Train (16135, 12288) (16135,)
Validation (4034, 12288) (4034,)

and then i implement the ImageDatagenerator as Augmentation

from keras.preprocessing.image import ImageDataGenerator

datagen = ImageDataGenerator(
        rotation_range=40,
        width_shift_range=0.2,
        height_shift_range=0.2,
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True,
        fill_mode='nearest')

datagen.fit(X_train.reshape(16135, 32, 32, 1))

But the output like this.

ValueErrorTraceback (most recent call last)
<ipython-input-26-7b4ec468a418> in <module>
     11         fill_mode='nearest')
     12 
---> 13 datagen.fit(X_train.reshape(16135, 32, 32, 1))

ValueError: cannot reshape array of size 198266880 into shape (16135,32,32,1)

Could anyone help?

0 Answers
Related