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

Non-deprecated tf.keras.preprocessing alternatives don't cover properly all the deprecated features #69834

Closed
SMH17 opened this issue Jun 15, 2024 · 6 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 TF 2.16 type:others issues not falling in bug, perfromance, support, build and install or feature

Comments

@SMH17
Copy link

SMH17 commented Jun 15, 2024

Issue type

Others

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

2.16.1

Custom code

No

OS platform and distribution

No response

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

tf.keras.preprocessing is deprecated . ImageDataGenerator is deprecated, but still there isn't any non-deprecated approach to consistently cover its features despite it's been a while already since the deprecation mark appeared.

E.g.
Consider you want to include random translations, rotations, and shear augmentations (very common augmentations, nothing unusual), with ImageDataGenerator you could do this in a very practical and concise way without forcing you to create your own augmentation functions (and if you needed more than built in features nothing prevented you to use preprocessing_function argument to pass your custom function or using different approaches).

Ok we know that "Google way" is "deprecate code in bulk" ...but what is supposed to be the recommended alternative approach now?
tf.keras.utils.image_dataset_from_directory
doesn't support any augmentation and so it is needed to manually combine it with image transformation functions to achieve same result,
but if as alternative you try to use a preprocessing pipeline with functions of tf.image, in tf.image, shear transformation seems surprisingly missing.

if instead you try to use as alternative tf.keras.layers there are various transformation layers, but not for everything in deprecation wagon and shear transformation seems missing also there, and tf.keras.preprocessing.image.random_shear is deprecated too.

(Not mentioning the past deprecation of tfa.image.* and tf.contrib.keras.preprocessing.*)

Standalone code to reproduce the issue

not needed

Relevant log output

No response

@google-ml-butler google-ml-butler bot added the type:others issues not falling in bug, perfromance, support, build and install or feature label Jun 15, 2024
@sushreebarsa sushreebarsa added comp:apis Highlevel API related issues TF 2.16 labels Jun 16, 2024
@tilakrayal tilakrayal added comp:keras Keras related issues and removed comp:apis Highlevel API related issues labels Jun 20, 2024
@tilakrayal
Copy link
Contributor

@SMH17,
Generally, if the particular API is deprecated, the new API will be serving the features of older ones with some other modifications. Also the API which you are mentioning tf.keras.preprocessing is related to Keras. Could you please feel free to raise the issue in keras-team/Keras repo for correct resolution.
https://keras.io/api/layers/preprocessing_layers/#image-augmentation-layers

Thank you!

@tilakrayal tilakrayal added the stat:awaiting response Status - Awaiting response from author label Jun 21, 2024
@SMH17
Copy link
Author

SMH17 commented Jun 21, 2024

@SMH17, Generally, if the particular API is deprecated, the new API will be serving the features of older ones with some other modifications. Also the API which you are mentioning tf.keras.preprocessing is related to Keras. Could you please feel free to raise the issue in keras-team/Keras repo for correct resolution. https://keras.io/api/layers/preprocessing_layers/#image-augmentation-layers

Thank you!

Referring to the example above. In Keras I don't see any deprecation mark in RandomShear layer that seems has been moved in keras-cv package but I cannot find any non-deprecated alternative in Keras module integrated in TensorFlow.
Image transformations should be consistently included in TensorFlow.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Jun 21, 2024
@tilakrayal
Copy link
Contributor

@SMH17,
Apologies for the delay. As the mentioned API keras.preprocessing i is more related to Keras, could you please raise the new issue in the keras-team/Keras repo for here for the quick resolution. Thank you!

@tilakrayal tilakrayal added the stat:awaiting response Status - Awaiting response from author label Jul 10, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Jul 18, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.

Copy link

Are you satisfied with the resolution of your issue?
Yes
No

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 TF 2.16 type:others issues not falling in bug, perfromance, support, build and install or feature
Projects
None yet
Development

No branches or pull requests

3 participants