Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageDataGenerator should have a verbosity argument #42681

Closed
jondo opened this issue Aug 26, 2020 · 10 comments · May be fixed by keras-team/keras-preprocessing#350
Closed

ImageDataGenerator should have a verbosity argument #42681

jondo opened this issue Aug 26, 2020 · 10 comments · May be fixed by keras-team/keras-preprocessing#350
Assignees
Labels
comp:keras Keras related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:feature Feature requests

Comments

@jondo
Copy link

jondo commented Aug 26, 2020

System information

  • TensorFlow version (you are using): 2.3.0
  • Are you willing to contribute it (Yes/No): No

Describe the feature and the current behavior/state.
When calling tensorflow.keras.preprocessing.image.ImageDataGenerator.flow_from_directory, currently a message like Found 1437 images belonging to 2 classes. is printed.

I suggest adding an optional keyword argument verbose with default setting verbose=1 to this function, such that verbose=0 suppresses this printed message. See e.g. the verbose keywords of tf.keras.Model.fit, or of the EarlyStopping or ModelCheckpoint callbacks.

Will this change the current api? How?
This will add an optional keyword argument.

Who will benefit with this feature?

  • Everyone who needs to call this function repeatedly in order to loop over different batch_size values during hyperparameter tuning. In this case, the repeated message is uninteresting and distracts from the interesting output and should therefore be omittable.
  • Everyone who upgraded from standalone Keras (which did not show this message, e.g. version 2.2.4), who wants to get the same output as before.
@jondo jondo added the type:feature Feature requests label Aug 26, 2020
@ravikyram ravikyram added the comp:keras Keras related issues label Aug 27, 2020
@ravikyram ravikyram assigned gowthamkpr and unassigned ravikyram Aug 27, 2020
@jondo
Copy link
Author

jondo commented Aug 27, 2020

Btw., standalone Keras (at least 2.2.4) did not print this message. I have now added this to the issue description.

@anuragcp
Copy link

I am a new contributor to tensorflow, and changed and added feature. But i can't push branch. shows error like this

remote: Permission to tensorflow/tensorflow.git denied to anuragcp.

@jondo
Copy link
Author

jondo commented Aug 27, 2020

@anuragcp, you have to push it to your own fork, then create a pull request.

@anuragcp
Copy link

Okey thanks. Let me check.

@gowthamkpr gowthamkpr assigned fchollet and unassigned gowthamkpr Aug 27, 2020
@gowthamkpr gowthamkpr added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Aug 27, 2020
@jondo
Copy link
Author

jondo commented Sep 3, 2020

I now found the relevant code location: It's in directory_iterator.py of the project keras_preprocessing!

Here is a similar issue: keras-team/keras-preprocessing#304 .

@ashwin-phadke
Copy link
Contributor

Hi @jondo , is this what you are looking for to implement, I don't know how correct this https://www.tensorflow.org/api_docs/python/tf/compat/v1/logging is as it is still in version 1 and there seem to be no ports to 2 and the only reference to it I found was for tf.autograph.set_verbosity. I hope this helps.
An simple high-level call I found was in keras.callbacks

if self.verbose > 0: print('\nEpoch %05d: saving model to %s' % (epoch + 1, filepath))

in tf./python./keras./callbacks using progbar

@jondo
Copy link
Author

jondo commented Sep 4, 2020

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.

@sachinprasadhs
Copy link
Contributor

tf.keras.preprocessing.image.ImageDataGenerator will be deprecated in upcoming Tensorflow version and is not recommended for new code. Prefer loading images with tf.keras.utils.image_dataset_from_directory and transforming the output tf.data.Dataset with preprocessing layers.

@sachinprasadhs sachinprasadhs added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels May 7, 2022
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label May 14, 2022
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author type:feature Feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants