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

implement transform_bounding_boxes for random_zoom #20526

Merged
merged 7 commits into from
Nov 22, 2024

Conversation

shashaka
Copy link
Contributor

@shashaka shashaka commented Nov 20, 2024

I have implemented the transform_bounding_boxes method to support random zoom functionality. If this implementation is satisfactory, I can proceed with adding corresponding test cases.

here is gist

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 89.58333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 82.14%. Comparing base (c802ca6) to head (009ef4c).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...s/preprocessing/image_preprocessing/random_zoom.py 89.58% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20526      +/-   ##
==========================================
+ Coverage   82.10%   82.14%   +0.04%     
==========================================
  Files         515      515              
  Lines       47790    47854      +64     
  Branches     7486     7493       +7     
==========================================
+ Hits        39238    39312      +74     
+ Misses       6738     6730       -8     
+ Partials     1814     1812       -2     
Flag Coverage Δ
keras 81.99% <87.50%> (+0.04%) ⬆️
keras-jax 65.10% <83.33%> (+0.05%) ⬆️
keras-numpy 60.08% <83.33%> (+0.05%) ⬆️
keras-tensorflow 66.08% <83.33%> (+0.04%) ⬆️
keras-torch 65.02% <83.33%> (+0.05%) ⬆️

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.


🚨 Try these New Features:

Copy link
Member

@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.

The code looks great! Please add a unit test.

# Conflicts:
#	keras/src/layers/preprocessing/image_preprocessing/random_zoom.py
#	keras/src/layers/preprocessing/image_preprocessing/random_zoom_test.py
@shashaka
Copy link
Contributor Author

I've added test cases. If there are any corrections needed, please feel free to share them with me.

Copy link
Member

@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.

Thanks for the update! The tests are looking good.

if backend_utils.in_tf_graph():
self.backend.set_backend("tensorflow")

def _get_transformed_x_y(x, y, transform):
Copy link
Member

Choose a reason for hiding this comment

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

Please move the functions _get_transformed_x_y and _get_clipped_bbox to be methods on the layer class rather than inlined function (for better eager performance).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have moved these functions to layer class. Thank you for your guidance.

Copy link
Member

@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.

LGTM, thank you!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Nov 22, 2024
@fchollet fchollet merged commit 9ac3ee5 into keras-team:master Nov 22, 2024
6 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels Nov 22, 2024
@shashaka shashaka deleted the random_zoom branch November 22, 2024 16:51
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.

4 participants