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

FR for keras.preprocessing.image_dataset_from_directory label_mode parameter to accept enum as input #46727

Closed
BlueskyFR opened this issue Jan 27, 2021 · 5 comments
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

@BlueskyFR
Copy link

BlueskyFR commented Jan 27, 2021

System information

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

Describe the feature and the current behavior/state.

When calling the tf.keras.preprocessing.image_dataset_from_directory() function, the parameter label_mode= accepts 3 values: int, categorical and binary. However, the string object is not deterministic: for that, I propose to add another option, which would be to specify the value using an enumeration which IS deterministic.

Will this change the current api? How?

No

Who will benefit with this feature?

Users who want more structured code.

Any Other info.

This behavior is, as far as I know, already available for some features in Keras.

@BlueskyFR BlueskyFR added the type:feature Feature requests label Jan 27, 2021
@ravikyram ravikyram added the comp:keras Keras related issues label Jan 27, 2021
@ravikyram ravikyram assigned ymodak and unassigned ravikyram Jan 27, 2021
@ymodak ymodak changed the title keras.preprocessing.image_dataset_from_directory label_mode parameter does not accept enum as input FR for keras.preprocessing.image_dataset_from_directory label_mode parameter to accept enum as input Jan 27, 2021
@ymodak ymodak added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jan 27, 2021
@fchollet
Copy link
Member

However, the string object is not deterministic: for that, I propose to add another option, which would be to specify the value using an enumeration which IS deterministic.

What does that mean?

@BlueskyFR
Copy link
Author

BlueskyFR commented Jan 29, 2021

However, the string object is not deterministic: for that, I propose to add another option, which would be to specify the value using an enumeration which IS deterministic.

What does that mean?

By accepting a string as input, typos can be made and no autocompletion can be offered by the IDE, which is however the case when using an enum.

My proposition is to add support for an alternative input type using an enumeration, such as tf.keras.preprocessing.label_mode.[INT|CATEGORICAL|BINARY] so that autocompletion can be made, typos are avoided, and users would still be free to specify a string "categorical" instead of tf.keras.preprocessing.label_mode.CATEGORICAL if they want.

What do you think?

@tensorflowbutler tensorflowbutler removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jan 31, 2021
@ymodak ymodak added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jan 31, 2021
@sachinprasadhs
Copy link
Contributor

tf.keras.preprocessing.image_dataset_from_directory will be deprecated in future Tensorflow version, prefer loading data with tf.keras.utils.image_dataset_from_directory, and then transforming the output tf.data.Dataset with preprocessing layers.
Let us know if you still face an issue. Thanks!

@sachinprasadhs sachinprasadhs added stat:awaiting response Status - Awaiting response from author and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Apr 28, 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 5, 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

No branches or pull requests

6 participants