Keras fit ImageDataGenerator when using flow_from_dataframe to read the data

Viewed 77

I'm trying to use the ImageDatGenerator with the following options

data_generator = ImageDataGenerator(featurewise_center=True, featurewise_std_normalization=True)

which would require to run the following line before using it.

data_generator.fit(train_data)

However, my training data information is in a dataframe which I read with the flow_from_dataframe function like this

data_generator.flow_from_dataframe(dataframe=data, directory=imgs_path, x_col="filename", y_col="class",
                                              class_mode="binary", target_size=(img_width,img_height),
                                              batch_size=batch_size)

So I don't have the training data available to fit the generator before calling the flow_from_dataframe function. Is there any workaround for this?

0 Answers
Related