keras-team/keras-preprocessing

Image data generator quiet mode?

ConnorBarnhill opened this issue · 4 comments

Is there any reason why there isn't a quiet mode for ImageDataGenerator.flow_from_dataframe? It's not ideal to see "Found {} non-validated image filenames." for every initialization.

There is no particular reason, would using the logging module good enough? You could disable the logs with an ENV var.

jondo commented

As described in tensorflow/tensorflow#42681, flow_from_directory is also affected.

Instead of switching the message via an ENV var I suggest adding an optional keyword argument verbose with default setting verbose=1 to these functions, such that verbose=0 suppresses these printed messages See e.g. the verbose keywords of tf.keras.Model.fit, or of the EarlyStopping or ModelCheckpoint callbacks.

Yes we can do that. PR welcome.

jondo commented

According to the release notes, current Tensorflow 2.3.0 introduced a new Keras dataset generation utility (emphasis added):

image_dataset_from_directory is a utility based on tf.data.Dataset, meant to replace the legacy ImageDataGenerator. It takes you from a structured directory of images to a labeled dataset, in one function call. Note that it doesn't perform image data augmentation (which is meant to be done using preprocessing layers).

This means that I'll simply comment out the annoying print command locally for now.