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 BASNet Segmentation Model (#2006) #2271

Merged

Conversation

hamidriasat
Copy link
Contributor

What does this PR do?

Adding BASNet model.

Overview:
This pull request addresses the assigned task (#2006) to integrate the BASNet segmentation model into KerasCV. The additions include the implementation of the BASNet model architecture and the inclusion of relevant test cases.

Weights and Future Plan:
I've included the BASNet model and its tests in this submission. Once they're reviewed and merged, I'll follow up with another PR to add the weights.

Fixes #2006

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue? Please add a link
    to it if that's the case. BASNet model
  • Did you write any new necessary tests?
  • If this adds a new model, can you run a few training steps on TPU in Colab to ensure that no XLA incompatible OP are used?

Who can review?

@divyashreepathihalli @tirthasheshpatel @martin-gorner @jbischof

Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

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

This is awesome!! Thank you for this contribution.

  • Lets increase the test coverage
  • The linter is not happy.
  • And there is one failing test in keras 3 - FAILED keras_cv/models/segmentation/basnet/basnet_test.py::BASNetTest::test_basnet_construction - AttributeError: module 'keras.backend' has no attribute 'int_shape'
  • Can we add a colab demo and a colab training script for this model?

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Jan 3, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Jan 3, 2024
@hamidriasat
Copy link
Contributor Author

@divyashreepathihalli Thanks! I'm delighted that you find it useful.

Recent commit:

  1. Improved test coverage as requested.
  2. Fixed linter issues.
  3. Added Keras3 support, resolving the mentioned error.
  4. Here is a colab script which supports model training on paper used dataset. I reused the code from one of my own contributions from here. I skipped TPU training because for that the data needed to be in GCP bucket which I do not have access right now. You can change the hyperparameters based on available resources for training.

Now, before merging with the master branch, all tests have passed successfully. Currently, one test test_with_model_preset_forward_pass is giving an error due to a recent kaggle_handle change.

Could you please clarify if you are going to upload the model to Kaggle and share the Kaggle handle link, or how this will work?

@divyashreepathihalli
Copy link
Collaborator

Awesome!! will review and merge soon! Thank you!!!

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Jan 16, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Jan 16, 2024
Copy link
Collaborator

@divyashreepathihalli divyashreepathihalli left a comment

Choose a reason for hiding this comment

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

I will need to upload the preset weights to Kaggle. Lets disable to preset tests for now.

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Jan 17, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Jan 17, 2024
@hamidriasat
Copy link
Contributor Author

@divyashreepathihalli Preset test disabled for now.

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Jan 17, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Jan 17, 2024
@divyashreepathihalli divyashreepathihalli merged commit 5796b76 into keras-team:master Jan 17, 2024
9 of 10 checks passed
@divyashreepathihalli
Copy link
Collaborator

Thank you for the awesome contribution. The PR is merged. We will upload the weights to Kaggle and add the presets

@divyashreepathihalli
Copy link
Collaborator

@hamidriasat the training is resulting in this error

WARNING:tensorflow:Gradients do not exist for variables ['conv1_conv/kernel:0', 'conv1_bn/gamma:0', 'conv1_bn/beta:0'] when minimizing the loss.

sampathweb pushed a commit that referenced this pull request Jan 31, 2024
* BASNet model initial code structure

* adding test and initial preset details

* adding comments

* cleaning and formatting code

* keras 3 support added

* disabling preset test for BASNet
sampathweb added a commit that referenced this pull request Jan 31, 2024
* Move keras-cv markdown files to toplevel (#2291)

Keras, KerasNLP and KerasTuner all store things liek the CONTRIBUTING.md
in the toplevel of the repo. We should do the same here.

* Add `version()` API to unify with Keras and KerasNLP (#2199)

* Unify `version` API with keras and keras_nlp

* Formatting

* Update to keep `version` parity with KerasNLP, support nightly version string

* Update version_utils.py

* Update version_utils.py

* Update random_crop_and_zoom.py (#2294)

* Update random_crop_and_zoom.py

* Update description

* rename file

* bug fix (#2303)

* Add BASNet Segmentation Model (#2006) (#2271)

* BASNet model initial code structure

* adding test and initial preset details

* adding comments

* cleaning and formatting code

* keras 3 support added

* disabling preset test for BASNet

* Fix image.shape type (#2305)

Fixed image.shape issue for tensorflow backend

* Create workflow for auto assignment of issues and for stale issues (#2313)

* Create auto-assignment.yaml

* Create auto-assignment.js

* Create stale-issue-pr.yaml

* Rename auto-assignment.yaml to auto-assignment.yml

* Rename stale-issue-pr.yaml to stale-issue-pr.yml

* Fix format and Update Vectorized Base (#2323)

* Fix CI Test for Basnet OOM and PyCoCo Test Failure for JAX (#2322)

* Reduce memory consumption for BasNet tests (#2325)

---------

Co-authored-by: Matt Watson <1389937+mattdangerw@users.noreply.github.com>
Co-authored-by: Gabriel Rasskin <43894452+grasskin@users.noreply.github.com>
Co-authored-by: Sachin Prasad <sachinprasad@google.com>
Co-authored-by: Haifeng Jin <5476582+haifeng-jin@users.noreply.github.com>
Co-authored-by: Hamid Ali <hamidriasat@gmail.com>
Co-authored-by: Tirth Patel <tirthasheshpatel@gmail.com>
yuvraj-wale pushed a commit to yuvraj-wale/keras-cv that referenced this pull request Feb 8, 2024
* BASNet model initial code structure

* adding test and initial preset details

* adding comments

* cleaning and formatting code

* keras 3 support added

* disabling preset test for BASNet
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.

BASNet model
4 participants