SAM 2 | Segment Anything Model 2

Опубликовано: 14 Май 2026
на канале: Code With Aarohi
9,894
264

Meta AI has released Segment Anything 2 (SAM 2), an advanced image and video segmentation foundation model. SAM 2 allows users to input points in an image to generate segmentation masks for those points, and it can also generate and track segmentation masks across frames in a video.

Segment Anything 2 (SAM 2) by Meta AI is open-source. It is a follow-up to the original Segment Anything Model (SAM) and is designed to enable zero-shot segmentation of objects in images.

Building on the original SAM model released by Meta last year, SAM 2 has been utilized for various vision applications, including image segmentation and as an image labeling assistant. Meta reports that SAM 2 is six times more accurate than its predecessor in image segmentation tasks.

In this guide, we will explore what Segment Anything 2 is, how it functions, and how you can leverage the model for image segmentation tasks.

Steps to run SAM 2:

conda create -n samm python=3.12

conda activate samm

git clone https://github.com/facebookresearch/s...

cd segment-anything-2

python setup.py build_ext --inplace

%cd checkpoints
double click on it. Model checkpoints will be downloaded in your directory.

Then install this- we need this to us the SAM 2 predictor and run the example notebooks,

pip install --no-build-isolation -e ".[demo]"

conda install jupyter notebook

jupyter notebook