# ImageDataGenerator augmenting only one image in training set

My datset consists of images in 10 classes. I am using 'ImageDataGenerator' to augment my training data using 'flow_from_directory' with training directory containing subdirectories of classes, each containing images belonging to each class.

train_data_generator=ImageDataGenerator(preprocessing_function=preprocess, rotation_range=20,width_shift_range=0.2,height_shift_range=0.2,horizontal_flip=True)


. I then use 'save_to_dir' attribute in 'flow_from_directory' to save the augmented images. But, after using 'fit_generator' method, I have found only copies of the first image of the last class in the directory. I have ~1200 different images in all. Please help.
Edit
It seems 'ImageDataGenerator' works alright when I don't define a 'preprocessing_func'. This is strange, because the documentation says that the preprocessing function is applied on each input.