[go: nahoru, domu]

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 support for PyTorch and Jax to KerasCV #1925

Merged
merged 22 commits into from
Jul 11, 2023
Merged

Add support for PyTorch and Jax to KerasCV #1925

merged 22 commits into from
Jul 11, 2023

Conversation

tirthasheshpatel
Copy link
Contributor
@tirthasheshpatel tirthasheshpatel commented Jul 10, 2023

What does this PR do?

This PR adds support for Keras Core, a new multi-backend implementation for Keras with support for TensorFlow, Jax, and PyTorch. Several backbones and layers have been ported to keras-core along with two object detection models, RetinaNet and YOLOV8.

Backbones ported:

Other components ported:

RetinaNet PR: ianstenbit#13
YOLOV8 PR: ianstenbit#8, #1920

Who can review?

@ianstenbit @jbischof @fchollet

ianstenbit and others added 15 commits June 30, 2023 08:23
#1903)

* Port preprocessing layers and bounding box utils to Keras Core

* Fix pip install

* Another git clone fix

* Fix for nested scopes

* Use PAT for git clone

* PAT structure

* Update actions.yml

* Update actions.yml

* Update actions.yml

* Int64 for jax

* Update utils

* Remove commented-out code

* ANY

* No any typehints

* Deploy key for install

* Remove prints

* SSH key as github action variable

* New ssh key approach

* Review comments

* Fancy pytest markers

* operations -> ops plus some test marks

* Add torch hax

* Fix TF marker

* Format

* Review comments

* rename tf_only to tf_keras_only

* Try installing keras core with pip_build

* s/_/-

* namex

* Namex fix + torch

* Rich

* requirements.txt

* I promise I have used a computer before

* Back to private API for now

* Fix path for backend

* Back to namex install

* Use correct policy API for mixed precision

* Reverse aliases

* Rely on keras-core for validation of backend

* Copy the homework of matt

* Newline
* Port backbones to Keras Core

* Fix YOLOV8 presets

* Fix tests

* Fix backbones

* utils -> saving

* YOLOV8 presets -- again

* saving for csp

* Test fixes

* Squeeze_excite

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
* Port losses to Keras Core

* Saving

* Fix focal

* Update CenterNetBoxLoss

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
* Port ImageClassifier to Keras Core

* Backbone property
* Port OD layers to Keras Core

* Add multi-backend NMS

* Use pytest fixture for skippage

* Nice asserts for tf.keras-only components

* Review comments

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
* Port RetinaNet to Keras Core

* Add defensive tuple casting

* Remove Torch one_hot workaround

* Cast to int
* Use torch-native NMS where possible

* Implement native NMS for Torch

* Remove prints

* valid_det is an int, foo

* fix num dets

* Comment
* Add keras-core as a dependency

* Install keras core from PyPi on CI

* Fix tf.keras CI
* Port YOLOV8 to Keras Core'

* Update test utils

* Mark backbone tests XL'

---------

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
@ianstenbit
Copy link
Contributor

A note for reviewers -- this code has all already been reviewed via PRs to the core branch. Any changes made after this comment have not yet been reviewed. (I suspect we may have to make some changes to make GCB happy)

@ianstenbit
Copy link
Contributor

/gcbrun

@tirthasheshpatel tirthasheshpatel changed the title Add support for Keras Core Add support for PyTorch and Jax to KerasCV Jul 10, 2023
@ianstenbit
Copy link
Contributor

/gcbrun

1 similar comment
@ianstenbit
Copy link
Contributor

/gcbrun

@ianstenbit
Copy link
Contributor

/gcbrun

@ianstenbit
Copy link
Contributor

/gcbrun

@ianstenbit
Copy link
Contributor

/gcbrun

@ianstenbit
Copy link
Contributor

/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!!!

@ianstenbit ianstenbit merged commit 993ff61 into master Jul 11, 2023
12 checks passed
@ianstenbit ianstenbit deleted the core branch July 11, 2023 00:50
ghost pushed a commit to y-vectorfield/keras-cv that referenced this pull request Nov 16, 2023
* Port preprocessing layers and bounding box utils to Keras Core [try 2] (keras-team#1903)

* Port preprocessing layers and bounding box utils to Keras Core

* Fix pip install

* Another git clone fix

* Fix for nested scopes

* Use PAT for git clone

* PAT structure

* Update actions.yml

* Update actions.yml

* Update actions.yml

* Int64 for jax

* Update utils

* Remove commented-out code

* ANY

* No any typehints

* Deploy key for install

* Remove prints

* SSH key as github action variable

* New ssh key approach

* Review comments

* Fancy pytest markers

* operations -> ops plus some test marks

* Add torch hax

* Fix TF marker

* Format

* Review comments

* rename tf_only to tf_keras_only

* Try installing keras core with pip_build

* s/_/-

* namex

* Namex fix + torch

* Rich

* requirements.txt

* I promise I have used a computer before

* Back to private API for now

* Fix path for backend

* Back to namex install

* Use correct policy API for mixed precision

* Reverse aliases

* Rely on keras-core for validation of backend

* Copy the homework of matt

* Newline

* Port backbones to Keras Core (keras-team#1906)

* Port backbones to Keras Core

* Fix YOLOV8 presets

* Fix tests

* Fix backbones

* utils -> saving

* YOLOV8 presets -- again

* saving for csp

* Test fixes

* Squeeze_excite

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>

* Port losses to Keras Core (keras-team#1905)

* Port losses to Keras Core

* Saving

* Fix focal

* Update CenterNetBoxLoss

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>

* Port ImageClassifier to Keras Core (keras-team#1908)

* Port ImageClassifier to Keras Core

* Backbone property

* Port object detection layers to Keras Core (keras-team#1907)

* Port OD layers to Keras Core

* Add multi-backend NMS

* Use pytest fixture for skippage

* Nice asserts for tf.keras-only components

* Review comments

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>

* Backbone property fix (keras-team#1909)

* Port RetinaNet to Keras Core (keras-team#1912)

* Port RetinaNet to Keras Core

* Add defensive tuple casting

* Remove Torch one_hot workaround

* Cast to int

* Port PyCOCOCallback to Keras Core (keras-team#1913)

* Fix default training value for SqueezeExcite (keras-team#1917)

* Update to_numpy to use Keras Core ops (keras-team#1916)

* Implement native NMS for PyTorch backend (keras-team#1918)

* Use torch-native NMS where possible

* Implement native NMS for Torch

* Remove prints

* valid_det is an int, foo

* fix num dets

* Comment

* Bump version to 0.6.0 for Keras Core release (keras-team#1919)

* Add keras-core as a dependency (keras-team#1922)

* Add keras-core as a dependency

* Install keras core from PyPi on CI

* Fix tf.keras CI

* Port YOLOV8 to Keras Core' (keras-team#1920)

* Port YOLOV8 to Keras Core'

* Update test utils

* Mark backbone tests XL'

---------

Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>

* Fix saving namespace for TF < 2.12

* Fix penalty reduced focal loss

* Run GPU tests on tf 2.13, require 2.12

* Run cpu tests on tf 2.13, require 2.13

* Fix ABI and FasterRCNN tests

---------

Co-authored-by: Ian Stenbit <3072903+ianstenbit@users.noreply.github.com>
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.

None yet

4 participants