Q: ImageDataGenerator Shape Issue I am new to Keras. I am having some issues with shape while using ImageDataGenerator . Below is my code:
train_batches = ImageDataGenerator().flow_from_directory(trainpath,target_size(227,227),classes=['class1','class2'])

x_train, y_train = next(train_batches)

When I print shape of x_train, it gives (32, 227, 227, 3). I am not sure where "32" is coming in the shape. Because of this, I am having issues with training the model.
Any suggestion?

A: There is parameter that goes inside the method flow_from directory called batch_size, You can learn more about it here 

https://keras.io/preprocessing/image/

So if you want to change the shape of the trainig batches generated, you can give a value for batch_size inside flow_from_directory()
train_batches = ImageDataGenerator().flow_from_directory(trainpath,target_size(227,227),batch_size=64,classes=['class1','class2'])

The above code will generate batches of shape (64,227,227,3). Hope this helps
