meta / sam-2-video

SAM 2: Segment Anything v2 (for videos)

replicate.com
Total runs: 2.6K
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Github
Model's Last Updated: August 14 2024

Introduction of sam-2-video

Model Details of sam-2-video

Readme

✨SAM 2: Segment Anything v2 for Videos🎥

NOTE: This implementation now supports video inputs and offers the large variant of the model.

About

Implementation of SAM 2 , a model for segmenting objects in videos and images using various prompts. This version fully supports video inputs.

How to Use SAM2 Inputs

SAM2 uses four main inputs to know where and what to look for in your video. Understanding how these work together is key to getting the results you want.

1. click_coordinates

This tells SAM2 exactly where to look in the video. It sets the number of points for all inputs.

  • Format: '[x,y],[x,y],[x,y]'
  • Example: '[100,100],[200,200],[300,300]'
  • This means: Look at 3 points because we have 3 [x,y] coordinates
  • Important: The number of [x,y] pairs here determines how many points SAM2 will consider
2. click_labels

This tells SAM2 if each point is part of the object (foreground) or not (background).

  • Format: '1,0,1'
  • 1 means foreground (part of the object)
  • 0 means background (not part of the object)
  • If fewer labels than points in click_coordinates , the last value repeats
3. click_frames

This tells SAM2 which frame of the video each point is in.

  • Format: '0,10,20'
  • If fewer frame numbers than points in click_coordinates , the last value repeats
  • If no frames given, all points are assumed to be on frame 0
4. click_object_ids

This gives names to the objects SAM2 is looking at. This is crucial for distinguishing between similar objects.

  • Format: 'person,dog,cat'
  • If fewer names than points in click_coordinates , it generates names like ‘ object_1','object_2',...
  • Important: The object IDs determine how SAM2 groups points into objects
Why Object IDs Matter:
  • Same ID = Same Object: If you give the same ID to multiple points, SAM2 assumes they’re part of the same object, even if they’re far apart.
  • Different IDs = Different Objects: Using different IDs tells SAM2 these are separate objects, even if they look similar.
Example: Two Birds in a Video
  • Scenario 1: Same ID click_coordinates: '[100,100],[300,300]' click_object_ids: 'bird,bird' Result: SAM2 might try to connect these points, assuming it’s one large or oddly shaped bird.

  • Scenario 2: Different IDs click_coordinates: '[100,100],[300,300]' click_object_ids: 'bird_1,bird_2' Result: SAM2 will treat these as two separate birds, creating distinct masks for each.

Using IDs to Refine Masks
  • If a single object isn’t masked properly, you can add more points with the same ID to refine the mask. click_coordinates: '[100,100],[150,150],[200,200]' click_object_ids: 'dog,dog,dog' This tells SAM2 “These are all part of the same dog” and helps refine the dog’s mask.
How They Work Together

Let’s look at an example to see how all inputs work together:

Example: Multiple Objects (5 points)
click_coordinates: '[100,100],[200,200],[300,300],[400,400],[500,500]'
click_labels: '1,1,0,1,1'
click_frames: '0,0,10,20,20'
click_object_ids: 'dog,dog,background,cat,cat'

This means (5 points because we have 5 [x,y] pairs): 1. Look for a dog at (100,100) in frame 0. It’s part of the object we want. 2. Look for the same dog at (200,200) in frame 0. It’s part of the object we want. 3. Look at (300,300) in frame 10. It’s background, not part of any object we want. 4. Look for a cat at (400,400) in frame 20. It’s part of an object we want. 5. Look for the same cat at (500,500) in frame 20. It’s part of the object we want.

SAM2 will create two separate masks: one for the dog (points 1 and 2) and one for the cat (points 4 and 5).

Important Things to Remember
  1. The number of [x,y] pairs in click_coordinates determines how many points SAM2 considers.
  2. Object IDs help SAM2 understand which points belong to the same object, even across different frames.
  3. Use different object IDs for separate objects, even if they’re the same type of thing (like two different birds).
  4. Use the same object ID to refine or extend the mask of a single object.
  5. If you provide fewer values for labels, frames, or object IDs than you have coordinates, SAM2 will repeat the last value to fill in the rest.
  6. SAM2 ignores spaces in your input, so '1, 0, 1' is the same as '1,0,1' .

By understanding these inputs and how they work together, you can guide SAM2 to accurately identify and mask objects in your video!

Limitations
  • Performance may vary depending on video quality and complexity.
  • Very fast or complex motions in videos might be challenging.
  • Higher resolutions provide more detail but require more processing time.

SAM 2 is a 🔥 model developed by Meta AI Research . It excels at segmenting objects in both images and videos with various types of prompts.

Core Model

model architecture
An overview of the SAM 2 framework.

SAM 2 uses a transformer architecture with streaming memory for real-time video processing. It builds on the original SAM model, extending its capabilities to video.

For more technical details, check out the Research paper .

Safety

⚠️ Users should be aware of potential ethical implications: - Ensure you have the right to use input images and videos, especially those featuring identifiable individuals. - Be responsible about generated content to avoid potential misuse. - Be cautious about using copyrighted material as inputs without permission.

Support

All credit goes to the Meta AI Research team

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}
}

Pricing of sam-2-video replicate.com

Run time and cost

This model runs on Nvidia A40 (Large) GPU hardware . We don't yet have enough runs of this model to provide performance information.

Runs of meta sam-2-video on replicate.com

2.6K
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About sam-2-video replicate.com Model

sam-2-video replicate.com

sam-2-video replicate.com is an AI model on replicate.com that provides sam-2-video's model effect (SAM 2: Segment Anything v2 (for videos)), which can be used instantly with this meta sam-2-video model. replicate.com supports a free trial of the sam-2-video model, and also provides paid use of the sam-2-video. Support call sam-2-video model through api, including Node.js, Python, http.

sam-2-video replicate.com Url

https://replicate.com/meta/sam-2-video

meta sam-2-video online free

sam-2-video replicate.com is an online trial and call api platform, which integrates sam-2-video's modeling effects, including api services, and provides a free online trial of sam-2-video, you can try sam-2-video online for free by clicking the link below.

meta sam-2-video online free url in replicate.com:

https://replicate.com/meta/sam-2-video

sam-2-video install

sam-2-video is an open source model from GitHub that offers a free installation service, and any user can find sam-2-video on GitHub to install. At the same time, replicate.com provides the effect of sam-2-video install, users can directly use sam-2-video installed effect in replicate.com for debugging and trial. It also supports api for free installation.

sam-2-video install url in replicate.com:

https://replicate.com/meta/sam-2-video

Url of sam-2-video

Provider of sam-2-video replicate.com

Other API from meta

replicate

An 8 billion parameter language model from Meta, fine tuned for chat completions

Total runs: 353.0M
Run Growth: 0
Growth Rate: 0.00%
Updated:April 18 2024
replicate

A 70 billion parameter language model from Meta, fine tuned for chat completions

Total runs: 149.0M
Run Growth: 0
Growth Rate: 0.00%
Updated:April 18 2024
replicate

Base version of Llama 3, an 8 billion parameter language model from Meta.

Total runs: 50.8M
Run Growth: 0
Growth Rate: 0.00%
Updated:April 18 2024
replicate

A 7 billion parameter language model from Meta, fine tuned for chat completions

Total runs: 17.5M
Run Growth: 0
Growth Rate: 0.00%
Updated:November 02 2023
replicate

A 70 billion parameter language model from Meta, fine tuned for chat completions

Total runs: 9.2M
Run Growth: 0
Growth Rate: 0.00%
Updated:September 13 2023
replicate

Meta's flagship 405 billion parameter language model, fine-tuned for chat completions

Total runs: 5.2M
Run Growth: 0
Growth Rate: 0.00%
Updated:July 23 2024
replicate

A 13 billion parameter language model from Meta, fine tuned for chat completions

Total runs: 4.8M
Run Growth: 0
Growth Rate: 0.00%
Updated:September 13 2023
replicate

Generate music from a prompt or melody

Total runs: 2.4M
Run Growth: 0
Growth Rate: 0.00%
Updated:March 28 2024
replicate

Base version of Llama 3, a 70 billion parameter language model from Meta.

Total runs: 825.5K
Run Growth: 0
Growth Rate: 0.00%
Updated:April 18 2024
replicate

A llama-3 based moderation and safeguarding language model

Total runs: 733.3K
Run Growth: 0
Growth Rate: 0.00%
Updated:May 08 2024
replicate

Base version of Llama 2 7B, a 7 billion parameter language model

Total runs: 651.1K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 13 2023
replicate

Base version of Llama 2, a 70 billion parameter language model from Meta.

Total runs: 351.9K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 13 2023
replicate

Base version of Llama 2 13B, a 13 billion parameter language model

Total runs: 201.7K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 13 2023
replicate

A 34 billion parameter Llama tuned for coding and conversation

Total runs: 154.7K
Run Growth: 0
Growth Rate: 0.00%
Updated:January 09 2024
replicate

A 13 billion parameter Llama tuned for code completion

Total runs: 112.4K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 29 2023
replicate

A 7 billion parameter Llama tuned for coding and conversation

Total runs: 65.1K
Run Growth: 0
Growth Rate: 0.00%
Updated:January 09 2024
replicate

A 13 billion parameter Llama tuned for coding and conversation

Total runs: 46.8K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 07 2023
replicate

A Llama-3.1-8B pretrained model, fine-tuned for content safety classification

Total runs: 31.1K
Run Growth: 0
Growth Rate: 0.00%
Updated:December 21 2024
replicate

Detects any class given class names

Total runs: 27.6K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 29 2022
replicate

Instance-Conditioned GAN

Total runs: 26.7K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 25 2021
replicate

A 70 billion parameter Llama tuned for coding and conversation

Total runs: 21.9K
Run Growth: 0
Growth Rate: 0.00%
Updated:January 31 2024
replicate

A 7 billion parameter Llama tuned for coding and conversation

Total runs: 15.4K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 07 2023
replicate

SAM 2: Segment Anything v2 (for Images)

Total runs: 11.5K
Run Growth: 0
Growth Rate: 0.00%
Updated:July 31 2024
replicate

A 17 billion parameter model with 128 experts

Total runs: 11.2K
Run Growth: 0
Growth Rate: 0.00%
Updated:April 06 2025
replicate

A 34 billion parameter Llama tuned for coding and conversation

Total runs: 10.0K
Run Growth: 0
Growth Rate: 0.00%
Updated:August 26 2023
replicate

A 34 billion parameter Llama tuned for coding with Python

Total runs: 6.5K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 29 2023
replicate

A 13 billion parameter Llama tuned for coding with Python

Total runs: 3.9K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 07 2023
replicate

A 7 billion parameter Llama tuned for coding with Python

Total runs: 3.8K
Run Growth: 0
Growth Rate: 0.00%
Updated:September 07 2023
replicate

Cut and Learn for unsupervised object detection and instance segmentation

Total runs: 2.3K
Run Growth: 0
Growth Rate: 0.00%
Updated:February 06 2023
replicate

A 70 billion parameter Llama tuned for coding with Python

Total runs: 1.1K
Run Growth: 0
Growth Rate: 0.00%
Updated:January 30 2024
replicate

Masked-attention Mask Transformer for Universal Image Segmentation

Total runs: 658
Run Growth: 0
Growth Rate: 0.00%
Updated:February 21 2022
replicate

Supervised Weakly from hashtAGs

Total runs: 294
Run Growth: 0
Growth Rate: 0.00%
Updated:January 23 2022
replicate

A Single Model for Many Visual Modalities

Total runs: 247
Run Growth: 0
Growth Rate: 0.00%
Updated:January 30 2022
replicate

A Llama-3.2-11B pretrained model, fine-tuned for content safety classification

Total runs: 153
Run Growth: 0
Growth Rate: 0.00%
Updated:December 24 2024
replicate

A 7B parameter Llama 2-based input-output safeguard model

Total runs: 19
Run Growth: 0
Growth Rate: 0.00%
Updated:December 21 2024
replicate

A 17 billion parameter model with 16 experts

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:April 06 2025