{"id":15358713,"url":"https://github.com/tirthasheshpatel/segment_anything_keras","last_synced_at":"2025-04-15T07:21:44.104Z","repository":{"id":182209592,"uuid":"639182895","full_name":"tirthasheshpatel/segment_anything_keras","owner":"tirthasheshpatel","description":"A multi-backend (TensorFlow, PyTorch, JAX, and NumPy) implementation of the Segment Anything model in Keras 3.0","archived":false,"fork":false,"pushed_at":"2024-04-02T20:22:22.000Z","size":56127,"stargazers_count":32,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T17:47:49.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tirthasheshpatel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-11T00:07:59.000Z","updated_at":"2025-02-04T22:44:48.000Z","dependencies_parsed_at":"2024-04-02T21:43:18.618Z","dependency_job_id":null,"html_url":"https://github.com/tirthasheshpatel/segment_anything_keras","commit_stats":null,"previous_names":["tirthasheshpatel/segment_anything_tensorflow"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tirthasheshpatel%2Fsegment_anything_keras","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tirthasheshpatel%2Fsegment_anything_keras/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tirthasheshpatel%2Fsegment_anything_keras/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tirthasheshpatel%2Fsegment_anything_keras/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tirthasheshpatel","download_url":"https://codeload.github.com/tirthasheshpatel/segment_anything_keras/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249024029,"owners_count":21200014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T12:42:18.546Z","updated_at":"2025-04-15T07:21:44.083Z","avatar_url":"https://github.com/tirthasheshpatel.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Segment Anything Model in Multi-Backend Keras\n\nThis is an implementation of the Segment Anything predictor and automatic mask\ngenerator in Keras 3.\n\nThe demos uses KerasCV's Segment Anything model:\n\n- [Predictor demo](Segment_Anything_multi_backend_Keras_Demo.ipynb)\n- [Atomatic Mask Generator demo](Segment_Anything_Automatic_Mask_Generator_Demo.ipynb)\n\n## Install the package\n\n```shell\npip install git+https://github.com/tirthasheshpatel/segment_anything_keras.git\n```\n\nInstall the required dependencies:\n\n```shell\npip install -U Pillow numpy keras keras-cv\n```\n\nInstall TensorFlow, JAX, or PyTorch, whichever backend you'd like to use.\n\nTo get all the dependencies and all the backends to run the demos, do:\n\n```shell\npip install -r requirements.txt\n```\n\n## Getting the pretrained Segment Anything Model\n\n```python\n# Use TensorFlow backend, choose any you want\nimport os\nos.environ['KERAS_BACKEND'] = \"tensorflow\"\n\nfrom keras_cv.models import SegmentAnythingModel\nfrom sam_keras import SAMPredictor\n\n# Get the huge model trained on the SA-1B dataset.\n# Other available options are:\n#   - \"sam_base_sa1b\"\n#   - \"sam_large_sa1b\"\nmodel = SegmentAnythingModel.from_preset(\"sam_huge_sa1b\")\n\n# Create the predictor\npredictor = SAMPredictor(model)\n\n# Now you can use the predictor just like the one on the original repo.\n# The only difference is list of input dicts isn't supported; instead\n# pass each input dict separately to the `predict` method.\n```\n\n## Notes\n\nRight now JAX and TensorFlow have large compile-time overhead. Prompt encoder\nrecompiles each time a different combination of prompts (points only,\npoints + boxes, boxes only, etc) is passed. To avoid this, compile the model\nwith `run_eagerly=True` and `jit_compile=False`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftirthasheshpatel%2Fsegment_anything_keras","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftirthasheshpatel%2Fsegment_anything_keras","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftirthasheshpatel%2Fsegment_anything_keras/lists"}