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

Add rand_augment processing layer #20716

Merged
merged 12 commits into from
Jan 7, 2025
Merged

Conversation

shashaka
Copy link
Contributor

@shashaka shashaka commented Jan 3, 2025

I have implemented the transform_images method in the RandAugment image processing layer. If this pull request is accepted, I can proceed with implementing the transform_bounding_boxes method as well.

here is my gist

@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 96.05263% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.95%. Comparing base (881d8da) to head (177654d).

Files with missing lines Patch % Lines
.../preprocessing/image_preprocessing/rand_augment.py 95.83% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20716      +/-   ##
==========================================
+ Coverage   81.83%   81.95%   +0.11%     
==========================================
  Files         552      553       +1     
  Lines       51363    51437      +74     
  Branches     7944     7953       +9     
==========================================
+ Hits        42034    42155     +121     
+ Misses       7375     7346      -29     
+ Partials     1954     1936      -18     
Flag Coverage Δ
keras 81.77% <96.05%> (+0.11%) ⬆️
keras-jax 64.04% <96.05%> (+0.09%) ⬆️
keras-numpy 58.90% <90.78%> (+0.08%) ⬆️
keras-openvino 29.84% <30.26%> (+<0.01%) ⬆️
keras-tensorflow 64.70% <96.05%> (+0.07%) ⬆️
keras-torch 64.11% <96.05%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@shashaka
Copy link
Contributor Author

shashaka commented Jan 5, 2025

@fchollet
I have updated the code based on your guidance and plan to implement the transform_bbox method in a separate PR for clearer review. Please feel free to share your thoughts.

@shashaka
Copy link
Contributor Author

shashaka commented Jan 6, 2025

@fchollet
I have also updated the transform_bounding_box method as per your guidance. Please let me know if any further corrections are required.

Here is my gist for bbox

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful -- thanks for the great work! LGTM

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jan 6, 2025
@fchollet fchollet merged commit ab3c8f5 into keras-team:master Jan 7, 2025
10 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase labels Jan 7, 2025
@shashaka shashaka deleted the rand_augment branch January 7, 2025 01:42
divyashreepathihalli added a commit that referenced this pull request Jan 9, 2025
* Specify window_length dtype requirement in tf.keras.ops.istft in math.py (#20728)

The `window_length` parameter in `tf.keras.ops.istft` requires `tf.int32` dtype, but this isn't documented. This can cause unexpected `ValueError` when using `tf.int64` and `tf.int16`

Here is the Example case:
```
import tensorflow as tf

input_dict = {
    'stfts': tf.constant([[-0.87817144+1.14583987j, -0.32066484+0.25565411j]], dtype=tf.complex128),
    'frame_length': tf.constant(256, dtype=tf.int16),
    'frame_step': tf.constant(5120,dtype=tf.int64)
}
result = tf.signal.inverse_stft(**input_dict)
print(result)
```
The code throws the following error:
```
ValueError: window_length: Tensor conversion requested dtype int32 for Tensor with dtype int64
```

* Add rand_augment processing layer (#20716)

* Add rand_augment init

* Update rand_augment init

* Add rand_augment

* Add NotImplementedError

* Add some test cases

* Fix failed test case

* Update rand_augment

* Update rand_augment test

* Fix random_rotation bug

* Add build method to supress warning.

* Add implementation for transform_bboxes

* Fixing batch_dim_name attribute (#20674)

* fixing wrong trainer assumption that batch dim is always the first one in the mesh

* need functools partial

* lint

* fix test failure when distribution=None

* lint2

* fix for test failure

* added data sharding for 3D+ meshes

* lint3

* added @Property for batch_dim_name + refactoring

* fix typo

* Add support for `dtype` / `DTypePolicy` to `JaxLayer` and `FlaxLayer`. (#20732)

The `dtype` / `DTypePolicy` is applied to all float variables.

* Allow dynamic shape in `STFTSpectrogram` layer. (#20736)

by simply using `ops.shape(x)` instead of `x.shape`.

* Remove duplicate export tests in `model_test`. (#20735)

The same tests exist at:
- https://github.com/keras-team/keras/blob/master/keras/src/export/saved_model_test.py#L66
- https://github.com/keras-team/keras/blob/master/keras/src/export/onnx_test.py#L62

The goal is to isolate the use of `onnxruntime` to a single file, `onnx_test.py`.

* Add OpenVINO into README.md (#20739)

* Add OpenVINO into README.md

Signed-off-by: Kazantsev, Roman <[email protected]>

* Update README.md

---------

Signed-off-by: Kazantsev, Roman <[email protected]>

* Multiple Example Title has removed in metrics.MeanIoU method (#20738)

Multiple Example Title has removed in metrics.MeanIoU method

---------

Signed-off-by: Kazantsev, Roman <[email protected]>
Co-authored-by: LakshmiKalaKadali <[email protected]>
Co-authored-by: Ugeun Park <[email protected]>
Co-authored-by: Martin Görner <[email protected]>
Co-authored-by: hertschuh <[email protected]>
Co-authored-by: Roman Kazantsev <[email protected]>
Co-authored-by: LavanyaKV1234 <[email protected]>
divyashreepathihalli added a commit that referenced this pull request Jan 9, 2025
* Specify window_length dtype requirement in tf.keras.ops.istft in math.py (#20728)

The `window_length` parameter in `tf.keras.ops.istft` requires `tf.int32` dtype, but this isn't documented. This can cause unexpected `ValueError` when using `tf.int64` and `tf.int16`

Here is the Example case:
```
import tensorflow as tf

input_dict = {
    'stfts': tf.constant([[-0.87817144+1.14583987j, -0.32066484+0.25565411j]], dtype=tf.complex128),
    'frame_length': tf.constant(256, dtype=tf.int16),
    'frame_step': tf.constant(5120,dtype=tf.int64)
}
result = tf.signal.inverse_stft(**input_dict)
print(result)
```
The code throws the following error:
```
ValueError: window_length: Tensor conversion requested dtype int32 for Tensor with dtype int64
```

* Add rand_augment processing layer (#20716)

* Add rand_augment init

* Update rand_augment init

* Add rand_augment

* Add NotImplementedError

* Add some test cases

* Fix failed test case

* Update rand_augment

* Update rand_augment test

* Fix random_rotation bug

* Add build method to supress warning.

* Add implementation for transform_bboxes

* Fixing batch_dim_name attribute (#20674)

* fixing wrong trainer assumption that batch dim is always the first one in the mesh

* need functools partial

* lint

* fix test failure when distribution=None

* lint2

* fix for test failure

* added data sharding for 3D+ meshes

* lint3

* added @Property for batch_dim_name + refactoring

* fix typo

* Add support for `dtype` / `DTypePolicy` to `JaxLayer` and `FlaxLayer`. (#20732)

The `dtype` / `DTypePolicy` is applied to all float variables.

* Allow dynamic shape in `STFTSpectrogram` layer. (#20736)

by simply using `ops.shape(x)` instead of `x.shape`.

* Remove duplicate export tests in `model_test`. (#20735)

The same tests exist at:
- https://github.com/keras-team/keras/blob/master/keras/src/export/saved_model_test.py#L66
- https://github.com/keras-team/keras/blob/master/keras/src/export/onnx_test.py#L62

The goal is to isolate the use of `onnxruntime` to a single file, `onnx_test.py`.

* Add OpenVINO into README.md (#20739)

* Add OpenVINO into README.md

Signed-off-by: Kazantsev, Roman <[email protected]>

* Update README.md

---------

Signed-off-by: Kazantsev, Roman <[email protected]>

* Multiple Example Title has removed in metrics.MeanIoU method (#20738)

Multiple Example Title has removed in metrics.MeanIoU method

---------

Signed-off-by: Kazantsev, Roman <[email protected]>
Co-authored-by: LakshmiKalaKadali <[email protected]>
Co-authored-by: Ugeun Park <[email protected]>
Co-authored-by: Martin Görner <[email protected]>
Co-authored-by: hertschuh <[email protected]>
Co-authored-by: Roman Kazantsev <[email protected]>
Co-authored-by: LavanyaKV1234 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants