{"id":20465583,"url":"https://github.com/kadirnar/segment-anything-video","last_synced_at":"2025-05-14T12:08:13.207Z","repository":{"id":151590092,"uuid":"624461258","full_name":"kadirnar/segment-anything-video","owner":"kadirnar","description":"MetaSeg: Packaged version of the Segment Anything repository","archived":false,"fork":false,"pushed_at":"2025-05-12T19:43:13.000Z","size":894,"stargazers_count":980,"open_issues_count":15,"forks_count":68,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-12T20:49:36.520Z","etag":null,"topics":["object-detection","object-segmentation","segment-anything","segmentation","yolov5","yolov6","yolov7","yolov8"],"latest_commit_sha":null,"homepage":"","language":"Python","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/kadirnar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-06T14:14:59.000Z","updated_at":"2025-05-09T13:21:47.000Z","dependencies_parsed_at":"2024-02-05T21:28:53.103Z","dependency_job_id":"521ba78e-a1f7-4783-8153-73e8b77780f1","html_url":"https://github.com/kadirnar/segment-anything-video","commit_stats":{"total_commits":99,"total_committers":4,"mean_commits":24.75,"dds":0.4444444444444444,"last_synced_commit":"43c8f8b0d7d606720b245c8dc321dc3cf499eaad"},"previous_names":["kadirnar/segment-anything-pip"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kadirnar%2Fsegment-anything-video","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kadirnar%2Fsegment-anything-video/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kadirnar%2Fsegment-anything-video/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kadirnar%2Fsegment-anything-video/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kadirnar","download_url":"https://codeload.github.com/kadirnar/segment-anything-video/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140756,"owners_count":22021219,"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":["object-detection","object-segmentation","segment-anything","segmentation","yolov5","yolov6","yolov7","yolov8"],"created_at":"2024-11-15T13:19:07.357Z","updated_at":"2025-05-14T12:08:13.122Z","avatar_url":"https://github.com/kadirnar.png","language":"Python","funding_links":[],"categories":["Python","Application"],"sub_categories":["Image Detection/Segmentation"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch2\u003e\n     MetaSeg: Packaged version of the Segment Anything repository\n\u003c/h2\u003e\n\u003cdiv\u003e\n    \u003cimg width=\"1000\" alt=\"teaser\" src=\"https://github.com/kadirnar/segment-anything-pip/releases/download/v0.2.2/metaseg_demo.gif\"\u003e\n\u003c/div\u003e\n    \u003ca href=\"https://pepy.tech/project/metaseg\"\u003e\u003cimg src=\"https://pepy.tech/badge/metaseg\" alt=\"downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://huggingface.co/spaces/ArtGAN/metaseg-webui\"\u003e\u003cimg src=\"https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg\" alt=\"HuggingFace Spaces\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.org/project/metaseg\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/metaseg?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/metaseg\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/dm/metaseg?color=red\" alt=\"Download Count\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/metaseg\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/metaseg.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/metaseg\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/status/metaseg?color=orange\" alt=\"Project Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://results.pre-commit.ci/latest/github/kadirnar/segment-anything-video/main\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://results.pre-commit.ci/badge/github/kadirnar/segment-anything-video/main.svg\" alt=\"pre-commit.ci\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\nThis repo is a packaged version of the [segment-anything](https://github.com/facebookresearch/segment-anything) model.\n\n### Installation\n```bash\npip install metaseg\n```\n\n### Usage\n```python\nfrom metaseg import SegAutoMaskPredictor, SegManualMaskPredictor\n\n# If gpu memory is not enough, reduce the points_per_side and points_per_batch.\n\n# For image\nresults = SegAutoMaskPredictor().image_predict(\n    source=\"image.jpg\",\n    model_type=\"vit_l\", # vit_l, vit_h, vit_b\n    points_per_side=16,\n    points_per_batch=64,\n    min_area=0,\n    output_path=\"output.jpg\",\n    show=True,\n    save=False,\n)\n\n# For video\nresults = SegAutoMaskPredictor().video_predict(\n    source=\"video.mp4\",\n    model_type=\"vit_l\", # vit_l, vit_h, vit_b\n    points_per_side=16,\n    points_per_batch=64,\n    min_area=1000,\n    output_path=\"output.mp4\",\n)\n\n# For manuel box and point selection\n\n# For image\nresults = SegManualMaskPredictor().image_predict(\n    source=\"image.jpg\",\n    model_type=\"vit_l\", # vit_l, vit_h, vit_b\n    input_point=[[100, 100], [200, 200]],\n    input_label=[0, 1],\n    input_box=[100, 100, 200, 200], # or [[100, 100, 200, 200], [100, 100, 200, 200]]\n    multimask_output=False,\n    random_color=False,\n    show=True,\n    save=False,\n)\n\n# For video\n\nresults = SegManualMaskPredictor().video_predict(\n    source=\"video.mp4\",\n    model_type=\"vit_l\", # vit_l, vit_h, vit_b\n    input_point=[0, 0, 100, 100],\n    input_label=[0, 1],\n    input_box=None,\n    multimask_output=False,\n    random_color=False,\n    output_path=\"output.mp4\",\n)\n```\n\n### [SAHI](https://github.com/obss/sahi) + Segment Anything\n\n```bash\npip install sahi metaseg\n```\n\n```python\nfrom metaseg.sahi_predict import SahiAutoSegmentation, sahi_sliced_predict\n\nimage_path = \"image.jpg\"\nboxes = sahi_sliced_predict(\n    image_path=image_path,\n    detection_model_type=\"yolov5\",  # yolov8, detectron2, mmdetection, torchvision\n    detection_model_path=\"yolov5l6.pt\",\n    conf_th=0.25,\n    image_size=1280,\n    slice_height=256,\n    slice_width=256,\n    overlap_height_ratio=0.2,\n    overlap_width_ratio=0.2,\n)\n\nSahiAutoSegmentation().image_predict(\n    source=image_path,\n    model_type=\"vit_b\",\n    input_box=boxes,\n    multimask_output=False,\n    random_color=False,\n    show=True,\n    save=False,\n)\n```\n\u003cimg width=\"700\" alt=\"teaser\" src=\"https://github.com/kadirnar/segment-anything-pip/releases/download/v0.5.0/sahi_autoseg.png\"\u003e\n\n### [FalAI(Cloud GPU)](https://docs.fal.ai/fal-serverless/quickstart) + Segment Anything\n```bash\npip install metaseg fal_serverless\nfal-serverless auth login\n```\n\n```python\n# For Auto Mask\nfrom metaseg import falai_automask_image\n\nimage = falai_automask_image(\n    image_path=\"image.jpg\",\n    model_type=\"vit_b\",\n    points_per_side=16,\n    points_per_batch=32,\n    min_area=0,\n)\nimage.show() # Show image\nimage.save(\"output.jpg\") # Save image\n\n# For Manual Mask\nfrom metaseg import falai_manuelmask_image\n\nimage = falai_manualmask_image(\n    image_path=\"image.jpg\",\n    model_type=\"vit_b\",\n    input_point=[[100, 100], [200, 200]],\n    input_label=[0, 1],\n    input_box=[100, 100, 200, 200], # or [[100, 100, 200, 200], [100, 100, 200, 200]],\n    multimask_output=False,\n    random_color=False,\n)\nimage.show() # Show image\nimage.save(\"output.jpg\") # Save image\n```\n# Extra Features\n\n- [x] Support for Yolov5/8, Detectron2, Mmdetection, Torchvision models\n- [x] Support for video and web application(Huggingface Spaces)\n- [x] Support for manual single multi box and point selection\n- [x] Support for pip installation\n- [x] Support for SAHI library\n- [x] Support for FalAI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkadirnar%2Fsegment-anything-video","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkadirnar%2Fsegment-anything-video","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkadirnar%2Fsegment-anything-video/lists"}