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

RandomColorDegeneration and Equalization are not implemented as vectorized operations #2120

Closed
sup3rgiu opened this issue Oct 27, 2023 · 2 comments · Fixed by #2214
Closed
Assignees
Labels
type:Bug Something isn't working

Comments

@sup3rgiu
Copy link
Contributor

Current Behavior:

As Keras_CV==0.6.4, RandomColorDegeneration and Equalization preprocessing layers are not subclasses of VectorizedBaseImageAugmentationLayer, thus resulting in a slow forward pass.

Expected Behavior:

RandomColorDegeneration and Equalization preprocessing layers should be subclasses of VectorizedBaseImageAugmentationLayer (introduced in v. 0.5.0).
The implementation of RandomColorDegeneration is quite straightforward, while RandomColorDegeneration has a potential bottleneck represented by tf.histogram_fixed_width.
In the following Colab I propose an implementation for both layers.

Colab:

This colab includes a possible vectorized implementation of the given layers, and also a benchmark.
https://colab.research.google.com/drive/1t5b4a11ae3HWxUoyL-R50E2z8dkNSQYP?usp=sharing

Version:

0.6.4

@sup3rgiu sup3rgiu added the type:Bug Something isn't working label Oct 27, 2023
@divyashreepathihalli
Copy link
Collaborator

@sup3rgiu thank you for filing the issue! If you can open a PR for vectorized implementation of these layers with example outputs showing different augmentations for each image in a batch. that would be great!

@sup3rgiu
Copy link
Contributor Author

sup3rgiu commented Dec 6, 2023

@sup3rgiu thank you for filing the issue! If you can open a PR for vectorized implementation of these layers with example outputs showing different augmentations for each image in a batch. that would be great!

Done #2214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Something isn't working
Projects
None yet
2 participants