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

Improve keras 3 detection #2132

Merged

Conversation

divyashreepathihalli
Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli commented Nov 6, 2023

To-dos added for after this PR is merged
convert these layers to keras 3. These layers are disabled for keras 3 for now.
dropblock_2d: #2135
BaseAugmentationLayer3D: #2136
fix legacy keras.engine import in predict_utils.py
#2134

These changes have been tested here
https://colab.sandbox.google.com/drive/1pGSji4tto6Fu88LXR0z4p7ExJZWNajGK#scrollTo=9s7Q0WbIa6vB

@divyashreepathihalli divyashreepathihalli marked this pull request as draft November 6, 2023 23:13
@divyashreepathihalli
Copy link
Collaborator Author

/gcbrun

@divyashreepathihalli divyashreepathihalli force-pushed the keras_3_detection branch 4 times, most recently from 97cf251 to 53a209a Compare November 7, 2023 01:46
@divyashreepathihalli
Copy link
Collaborator Author

/gcbrun

@divyashreepathihalli
Copy link
Collaborator Author

/gcbrun

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Left a few comments. I am a little suspicious of the tf_ops.py file changes, but I may not be fully understand that yet.

keras_cv/backend/__init__.py Show resolved Hide resolved
keras_cv/backend/ops.py Outdated Show resolved Hide resolved
keras_cv/backend/tf_ops.py Show resolved Hide resolved
@divyashreepathihalli
Copy link
Collaborator Author

/gcbrun

Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Looks good! Only big question is with random. I don't think we should import tensorflow.random and keras.random as if they were interchangeable.

keras_cv/backend/__init__.py Show resolved Hide resolved
@@ -25,5 +28,5 @@
from keras_core.src.utils.image_utils import ( # noqa: F403, F401
smart_resize,
)
else:
if not multi_backend():
from keras_cv.backend.tf_ops import * # noqa: F403, F401
Copy link
Member

Choose a reason for hiding this comment

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

Why are we importing tf_ops twice? Once here and once from the toplevel __init__.py? Do we need both?

Copy link
Collaborator Author

@divyashreepathihalli divyashreepathihalli Nov 9, 2023

Choose a reason for hiding this comment

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

I think this was added to have tf_ops to be available through keras_cv.backend.ops.* instead of keras_cv.backend.tf_ops.*

keras_cv/backend/random.py Outdated Show resolved Hide resolved
keras_cv/layers/regularization/dropblock_2d.py Outdated Show resolved Hide resolved
keras_cv/backend/tf_ops.py Show resolved Hide resolved
keras_cv/backend/tf_ops.py Outdated Show resolved Hide resolved
keras_cv/backend/keras.py Show resolved Hide resolved
@divyashreepathihalli
Copy link
Collaborator Author

/gcbrun

@divyashreepathihalli divyashreepathihalli marked this pull request as ready for review November 9, 2023 18:25
Copy link
Member

@mattdangerw mattdangerw left a comment

Choose a reason for hiding this comment

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

Very nice work! This looks great!

@divyashreepathihalli divyashreepathihalli merged commit 26bcee8 into keras-team:master Nov 9, 2023
9 checks passed
yuvraj-wale pushed a commit to yuvraj-wale/keras-cv that referenced this pull request Feb 8, 2024
* improve keras 3 detection

* update __init__

* update config

* update config to update multibackend flag

* updated spelling error

* updatconfig

* update tf_ops

* update tf -ops

* update tf ops

* undo last commit

* update tf_ops.py

* reformat

* update init()

* update minor error in tf ops

* remove check for keras 3

* revert changes to tf_ops

* disable layers using internal base random layer

* update syntax error

* update imports in keras version check layer

* update init method in keras version check

* add seed argument

* rasie error in class itself

* update constructor

* update to import directly from layers

* update import in base image augmenattion layer

* change import sin tf_ops

* update tf ops import

* change init

* update tf_ops

* update backend functions

* keras.src

* update namespace

* update namescope correctly

* code reformat

* reformat and add backend functions

* modified ops import

* reformat

* update ops

* update backend

* update ops

* code reformatted

* update import

* update imports in ops

* update error message

* review changes added

* update keras imports

* update imports

* update imports

* update import in random.py

* add issues link

* code reformat

* code reformat

* review comments addressed

* code reformat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants