Skip to main content

Open In Colab Build and Tests

CPU compatible fork of the official SAMv2 implementation.

Features 🚀

  • CPU compatible
  • ships with config files
  • Run image and video inference on CPUs
  • Example notebooks showcasing inference using weights and biases.

Installation

You can download it from pypi using pip as follows:

pip install samv2

or from the repository:

pip install git+https://github.com/SauravMaheshkar/samv2.git

Usage

After downloading the official weights, you can use the load_model() helper method to instantiate a model.

from sam2 import load_model

model = load_model(
    variant="tiny",
    ckpt_path="artifacts/sam2_hiera_tiny.pt",
    device="cpu"
)
  • Open In Colab Example Notebook to run prompted segmentation on images logging predictions as W&B Tables.
  • Open In Colab Example Notebook to run automatic segmentation on images logging predictions as W&B Tables.

Citation

@article{ravi2024sam2,
  title={SAM 2: Segment Anything in Images and Videos},
  author={Ravi, Nikhila and Gabeur, Valentin and Hu, Yuan-Ting and Hu, Ronghang and Ryali, Chaitanya and Ma, Tengyu and Khedr, Haitham and R{\"a}dle, Roman and Rolland, Chloe and Gustafson, Laura and Mintun, Eric and Pan, Junting and Alwala, Kalyan Vasudev and Carion, Nicolas and Wu, Chao-Yuan and Girshick, Ross and Doll{\'a}r, Piotr and Feichtenhofer, Christoph},
  journal={arXiv preprint},
  year={2024}
}

Metadata

Release files for samv2 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for samv2 0.0.4
File Size Uploaded
samv2-0.0.4.tar.gz 59.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for samv2 0.0.4
File Interpreter ABI Platform
samv2-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 132.6 kB

Release files / samv2-0.0.4.tar.gz

Download URL samv2-0.0.4.tar.gz
Size 59.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2e7fce4b93e45db02485ee41f8a0853e1b9ddf4ecfb474c2f32b8fdbfd7cd543
BLAKE2b-256 checksum
How to use checksums
68d4e6a7b4f5e22e4b2e17644e9612a30549dfda5e54ca9c626de7348dce7ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.13

Release files / samv2-0.0.4-py3-none-any.whl

Download URL samv2-0.0.4-py3-none-any.whl
Size 73.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62978465118431c7e4b3509787b5f97fd1d6dd388afbac2056f24721fa056e27
BLAKE2b-256 checksum
How to use checksums
fb348717081299a56d169c567bc14197d1294e3fccea303159e86e0a2bfaa1cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page