enter image description hereI know that the problem is related to a certain shape when we reach the flatten layer in the model but I am not able to correct it.
train_it = datagen.flow_from_directory(training_path, batch_size=50, target_size=(300,300), class_mode='binary')
eval_it = datagen.flow_from_directory(validation_path, batch_size=10, class_mode='binary')
model=Sequential()
model.add(Conv2D(64, (3,3), input_shape=(300,300,3),padding = 'same', activation='relu'))
model.add(AveragePooling2D())
model.add(Conv2D(96, (3,3),padding='same' ,activation='relu'))
model.add(AveragePooling2D())
model.add(Conv2D(32, (3,3) ,activation='relu'))
model.add(AveragePooling2D())
model.add(Flatten())
model.add(Dense(50, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))