Meta SAM 3 Playground

Images and video · 2024

Meta SAM 2: Segment Anything in Images and Video Click an object once and SAM 2 follows it through the whole clip. Here is how it works, what SAM 2.1 changed, and when to choose SAM 3 instead.

Meta SAM 2 tracking an object through video frames

At a glance

SAM 2 in six facts

Jul 2024released by Meta; SAM 2.1 in Sep 2024
Images + videoone model for both
3 promptspoints, boxes and masks
~44 FPSreal-time feel, per Meta
SA-V~51K videos, 600K+ masklets
Apache 2.0licence for code and weights

Is SAM 2 still the latest? SAM 2.1 is the latest SAM 2 release. Meta has since released SAM 3 and the current SAM 3.1, which add text prompts and build their video tracker on SAM 2’s design. SAM 2 is still a strong, lighter choice for click-based video tracking.

Overview

What is Meta SAM 2?

Meta SAM 2 (Segment Anything Model 2) is a promptable segmentation model for both images and video. In a photo it works like the original SAM. In a video, you prompt an object once and SAM 2 keeps its mask on it, frame after frame.

one click, whole clip
Animation: one click tracked across video framesFour video frames of a ball moving up and to the right. A click on frame one creates a blue mask, which then appears on the ball in each following frame with the same ID. click once on frame 1 → mask follows the object frame 1frame 2frame 3frame 4 id 1
Illustration: a single click on frame 1 becomes a mask that follows the object, keeping the same ID.

What goes in, and what comes out

  • In: an image or a video. SAM 2 treats a photo as a video with a single frame, so one model handles both.
  • In: a visual prompt. Clicks, a box or a mask on any frame.
  • Out: a “masklet”. A mask for the object on every frame, with one ID, so you can follow it through the clip.

The big step from SAM 1: SAM 1 only saw single images. SAM 2 adds memory, so it remembers what the object looked like in earlier frames. See our video segmentation guide.

Architecture

How SAM 2 Works: Streaming Memory

SAM 2 reads a video one frame at a time, like a stream. Before predicting each mask, it looks back at a memory of earlier frames. That is what lets it keep track of an object as it moves, turns or is briefly hidden.

streaming memory · simplified
Animated diagram of SAM 2 streaming memoryEach new frame goes through an image encoder, then a memory attention step that looks at the memory bank, then the mask decoder. The memory encoder turns each prediction into a memory and stores it back in the memory bank, so the loop continues frame by frame. Frame tone at a time Imageencoder Memoryattention Mask decoder+ occlusion check Memoryencoder Memory bank past frames +prompted frames memory feeds back into the next frame (green path)
Simplified diagram based on Meta’s description. Each block lights up in turn.
  1. 1Image encoderTurns the current frame into features, once per frame.
  2. 2Memory attentionCompares the current frame with the memory bank before predicting a mask.
  3. 3Mask decoderPredicts the mask, plus an occlusion check that says whether the object is visible in this frame at all.
  4. 4Memory encoder and bankTurns each new prediction into a memory and stores it with memories from earlier and prompted frames.

Because frames are processed one by one, SAM 2 can work on long videos and live streams without loading the whole clip at once.

Prompts and corrections

Prompt Once, Correct Anywhere

SAM 2 uses the same visual prompts as SAM 1: points, boxes and masks. The difference is where you can use them: on any frame, and as many times as you need.

correcting a drifting track
Animation of correcting a track on a later frameFour frames of a car. On frame three the mask drifts and covers part of the background. A corrective click on frame three fixes it, and frames three and four update. fix one frame → the rest update frame 1frame 2frame 3frame 4 drift: mask spills onto the road one click on frame 3 → fixed ✓
Illustration: when a mask drifts, one corrective click on that frame fixes it, and the frames after it update.
  • Points. Positive clicks on the object, negative clicks on what to leave out.
  • Boxes. A rough rectangle around the object on one frame.
  • Masks. An existing mask, for example from another tool, to refine and follow.
  • Corrections on any frame. If the track drifts, click again on that frame and SAM 2 updates the frames after it.
  • Several objects. Give each object its own ID and track them together.

SAM 2 does not understand text. Typing “all red cars” needs SAM 3. More in our prompt guide.

Occlusion

When Objects Disappear and Come Back

Real video is messy: people walk behind things, cars leave the frame. SAM 2 has a dedicated check for this, so it can say “not visible here” instead of guessing a wrong mask.

hidden, then back
Animation of SAM 2 handling an occlusionA person walks behind a pillar and out the other side. While hidden, a label reads "not visible". When the person reappears, the mask returns with the same ID. id 1 occlusion: hidden behind a pillar not visible back · same id ✓
Illustration: the object keeps its ID while it is hidden and when it reappears.
  • Occlusion check. For each frame, SAM 2 predicts whether the object is present at all.
  • Memory bridges the gap. When the object returns, the memory of earlier frames helps re-find it with the same ID.
  • Better in SAM 2.1. Meta says the 2.1 checkpoints improved handling of occlusions and of visually similar objects.

Very long occlusions or crowded scenes can still break a track. See tracking loses objects.

Training data

The SA-V Dataset

To teach SAM 2 about motion, Meta built SA-V (Segment Anything Video), a large set of real-world videos with objects outlined over time.

SA-V at a glance
Animation of the SA-V dataset scaleA grid of small video thumbnails fills in, next to the dataset figures: about 51,000 videos, more than 600,000 masklets, filmed in 47 countries. SA-V · real-world videos ~51Kvideos 600K+masklets (masks over time) 47countries
Illustration of the dataset scale. Figures from Meta’s SAM 2 announcement.
  • About 51,000 videos of real-world scenes, filmed in 47 countries.
  • More than 600,000 masklets. A masklet is one object’s mask followed through a video.
  • Whole objects and parts, including objects that get hidden, disappear and reappear.
  • Made with a data engine. SAM 2 itself helped annotators, which Meta says was 8.4 times faster than annotating each frame with SAM.

SA-V is released under the CC BY 4.0 licence.

Model sizes

SAM 2.1 Checkpoints: Tiny, Small, Base+ and Large

SAM 2 comes in four sizes. The SAM 2.1 versions, released on 29 September 2024, replace the original July checkpoints and match or beat them on every video benchmark in Meta’s table.

From Meta’s sam2 repository. Speed measured on an NVIDIA A100 with torch 2.5.1. J&F is a standard video segmentation accuracy score: higher is better.
CheckpointParametersSpeed (FPS)SA-V test (J&F)MOSE val (J&F)LVOS v2 (J&F)
sam2.1_hiera_tiny38.9M91.276.571.877.3
sam2.1_hiera_small46M84.876.673.578.3
sam2.1_hiera_base_plus80.8M64.178.273.778.2
sam2.1_hiera_large Best224.4M39.579.574.680.6

Quick rule: start with base+ for a good balance, use large when accuracy matters most, and tiny or small for speed or smaller GPUs. Upgrading from the July 2024 checkpoints? You need the latest code from the repository.

Performance

Speed and Accuracy

Meta’s headline results for SAM 2, compared with earlier methods and with the original SAM.

~44 FPSinference speed, which Meta describes as real-time
6× fasterthan SAM 1 on Meta’s 23-dataset image benchmark
3× fewerhuman clicks needed for interactive video segmentation
8.4× fastervideo annotation than using SAM frame by frame

SAM 2 also scores higher than SAM 1 on that image benchmark, and performs strongly on standard video benchmarks such as DAVIS, MOSE, LVOS and YouTube-VOS. Real speed on your machine depends on GPU, resolution and checkpoint size.

Use cases

What People Use SAM 2 For

Video editing

Rotoscope a person, car or product once, then grade, blur or add effects to just that subject.

Sports and broadcast

Click players or the ball on a key frame and follow them for highlights, heat maps and overlays.

Traffic and monitoring

Track vehicles, people and bikes in camera feeds to count them or measure how long they stay.

Video data labelling

Label a few frames and let SAM 2 fill in the rest, then correct what it misses.

Robotics

Keep a stable mask on an object a robot is reaching for, even as the camera moves.

Science and medicine

Follow cells, animals or structures through microscope or ultrasound video, often after fine-tuning.

More examples on our use cases page.

Strengths and limits

Strengths and Limitations of SAM 2

Strengths

  • One model for images and video.
  • Prompt once, track the whole clip, with corrections on any frame.
  • Handles occlusion with a dedicated visibility check.
  • Fast: about 44 FPS, and faster than SAM 1 on images.
  • Four sizes from 38.9M to 224.4M parameters.
  • Open: Apache 2.0 code and weights, CC BY 4.0 dataset, and released training code.

Limitations (as Meta lists them)

  • Can lose track after big viewpoint changes, long occlusions, in crowded scenes or long videos.
  • Can confuse look-alikes when several similar objects are close together.
  • Slower with many objects, because each object is processed separately.
  • Fine detail and fast motion can produce missed details or jittery masks.
  • No text prompts. You must click, box or mask.

Several of these are what SAM 3.1 targets, for example faster multi-object tracking. See also slow video tracking.

How to use

How to Use Meta SAM 2

Try it in your browser with no setup, or run the open-source code on your own GPU.

Without code

  1. 1Open a playgroundUpload an image or a short video in our Playground, or use Meta’s own SAM 2 demo.
  2. 2Click the objectAdd clicks until the mask on the first frame looks right.
  3. 3Track and fixLet it run through the clip, then click again on any frame that drifts.
  4. 4ExportDownload the masks or the cut-out video. See how to export masks.

With code: install

Requires Python 3.10 or later, PyTorch 2.5.1 or later and TorchVision 0.20.1 or later, on a CUDA GPU. On Windows, Meta recommends WSL with Ubuntu.

git clone https://github.com/facebookresearch/sam2.git && cd sam2
pip install -e .
cd checkpoints && ./download_ckpts.sh && cd ..

For single images, use SAM2ImagePredictor, which works much like SAM 1’s predictor. Models can also be loaded straight from Hugging Face with from_pretrained.

With code: track an object in a video

import numpy as np, torch
from sam2.build_sam import build_sam2_video_predictor

predictor = build_sam2_video_predictor(
    "configs/sam2.1/sam2.1_hiera_l.yaml",
    "./checkpoints/sam2.1_hiera_large.pt",
)

with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
    # 1. Load the video (a folder of JPEG frames)
    state = predictor.init_state(video_path="my_video_frames/")

    # 2. Click once on frame 0 to start tracking object 1
    predictor.add_new_points_or_box(
        inference_state=state, frame_idx=0, obj_id=1,
        points=np.array([[300, 200]], dtype=np.float32),
        labels=np.array([1], dtype=np.int32),  # 1 = include
    )

    # 3. Follow it through the rest of the video
    for frame_idx, obj_ids, mask_logits in predictor.propagate_in_video(state):
        masks = (mask_logits > 0.0).cpu().numpy()

Based on the official sam2 repository. SAM 2 is also available in tools such as Ultralytics and Roboflow. For a full walkthrough, see the Python tutorial.

Comparison

SAM 2 vs SAM 1 vs SAM 3: Which Should You Use?

SAM 2 sits in the middle of the family: it added video to SAM 1, and SAM 3 later added text and concept prompts on top of it.

the Segment Anything family
Timeline of the Segment Anything familyFive releases on a line: SAM in April 2023, SAM 2 in July 2024, SAM 2.1 in September 2024, SAM 3 in November 2025 and SAM 3.1 in March 2026. SAM 2 and SAM 2.1 are highlighted. SAMApr 2023SAM 2Jul 2024SAM 2.1Sep 2024SAM 3Nov 2025SAM 3.1Mar 2026 this page current →
Release timeline from Meta’s announcements and repositories.
ModelWorks onPromptsBest for
SAM 1ImagesPoints, boxes, masksClick-based cut-outs in photos
SAM 2 / 2.1Images, videoPoints, boxes, masksTracking the objects you click
SAM 3Images, videoText, exemplars, points, boxes, masksFinding every instance of a concept
SAM 3.1Images, videoSame as SAM 3New projects, many objects in video

SAM 2 or SAM 3? SAM 2 is “track this object I clicked”. SAM 3 is “find every X and follow them”. If people will click what to track, SAM 2 is lighter and has the more permissive Apache 2.0 licence. If you want to describe objects in words, choose SAM 3.

Detailed comparisons: SAM 3 vs SAM 2 · SAM 3 vs SAM 3.1 · alternatives

Questions

SAM 2 FAQ

What is Meta SAM 2?

Meta SAM 2 (Segment Anything Model 2) is Meta’s second Segment Anything model. It segments objects in images and video from clicks, boxes or masks, and in video it keeps following the object from frame to frame.

When was SAM 2 released?

Meta released SAM 2 on 29 July 2024. Improved SAM 2.1 checkpoints, along with training code and a web demo, followed at the end of September 2024.

What is the difference between SAM 2 and SAM 2.1?

SAM 2.1 is an updated set of checkpoints using the same approach. Meta says it performs better on visually similar objects and on occlusions. Use SAM 2.1 checkpoints if you choose SAM 2.

Can SAM 2 understand text prompts?

No. SAM 2 uses visual prompts only: points, boxes and masks. To find objects by typing a description, use SAM 3 or SAM 3.1.

How fast is SAM 2?

Meta reports about 44 frames per second, and six times faster than the original SAM on images. Repository benchmarks on an A100 GPU range from about 39 FPS for the large model to about 91 FPS for the tiny one.

Is SAM 2 free for commercial use?

The SAM 2 model weights and code are released under Apache 2.0, and the SA-V dataset under CC BY 4.0. This is a summary, not legal advice, so read the licences before you ship a product.

Should I use SAM 2 or SAM 3?

Use SAM 2 if people will click the objects to track and you want a lighter model with a permissive Apache 2.0 licence. Use SAM 3 or SAM 3.1 if you want to type what to find and get every match.

Keep reading

Sources