im working on image classification CNN and i'm wondering how can i get x_train and y_train form using ImageGenerator. the reason of this is i want to fit my model as fit note fit.generator
trainDataGen = ImageDataGenerator(rescale= 1./255,
rotation_range =30,
width_shift_range=0.1,
height_shift_range=0.1,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=False,
vertical_flip=False,
fill_mode='nearest',
)
trainGenSet = trainDataGen.flow_from_directory(
path +'Train',
target_size=(28,28),
batch_size=32,
class_mode='categorical',
color_mode='grayscale',
)
x_train, y_train = trainGenSet.next()
the print(x_train) is (32,28,28,1) because of the batch size 32. i have total 5000 of train data Set and i want to get (5000,28,28,1) for print(x_train)