SAM2 Video
Track and segment objects in video with Meta's SAM2 on Clore.ai
Track and segment any object through video with Meta's SAM2.1 — the improved version of SAM2 with enhanced video accuracy.
All examples can be run on GPU servers rented through CLORE.AI Marketplace.
Renting on CLORE.AI
Visit CLORE.AI Marketplace
Filter by GPU type, VRAM, and price
Choose On-Demand (fixed rate) or Spot (bid price)
Configure your order:
Select Docker image
Set ports (TCP for SSH, HTTP for web UIs)
Add environment variables if needed
Enter startup command
Select payment: CLORE, BTC, or USDT/USDC
Create order and wait for deployment
Access Your Server
Find connection details in My Orders
Web interfaces: Use the HTTP port URL
SSH:
ssh -p <port> root@<proxy-address>
What is SAM2?
SAM2 (Segment Anything Model 2) by Meta AI enables:
Real-time video object segmentation
Click-to-track any object
Consistent tracking through occlusions
Memory-efficient video processing
What's New in SAM2.1
SAM2.1 brings significant improvements over the original SAM2:
Improved video accuracy — Better tracking through occlusions and fast motion
Enhanced memory module — More consistent long-range tracking
New checkpoints —
sam2.1_hiera_*series with better performanceOfficial pip package — Install with
pip install sam-2(no manual build required)Faster inference — Optimized CUDA kernels
Resources
GitHub: facebookresearch/sam2
Paper: SAM2 Paper
Demo: SAM2 Demo
Model Weights: SAM2.1 Checkpoints
Recommended Hardware
GPU
RTX 3060 12GB
RTX 4080 16GB
RTX 4090 24GB
VRAM
8GB
16GB
24GB
CPU
4 cores
8 cores
16 cores
RAM
16GB
32GB
64GB
Storage
30GB SSD
50GB NVMe
100GB NVMe
Internet
100 Mbps
500 Mbps
1 Gbps
Quick Deploy on CLORE.AI
Docker Image:
Ports:
Command:
Accessing Your Service
After deployment, find your http_pub URL in My Orders:
Go to My Orders page
Click on your order
Find the
http_pubURL (e.g.,abc123.clorecloud.net)
Use https://YOUR_HTTP_PUB_URL instead of localhost in examples below.
Installation
Alternative: From Source (for development)
What You Can Create
Video Editing
Remove objects from videos
Replace backgrounds seamlessly
Create video masks for compositing
Sports Analysis
Track players through games
Analyze movement patterns
Generate highlight reels
Medical Imaging
Segment organs in CT/MRI videos
Track cell movement in microscopy
Measure growth over time
Surveillance & Security
Track objects across cameras
Count people/vehicles
Anomaly detection
Creative Projects
Rotoscoping for VFX
Interactive video installations
AR/VR content creation
Basic Usage
Image Segmentation
Video Object Tracking
Multi-Object Tracking
Box Prompt Segmentation
Gradio Interface
Export Masks as Video
Performance
Image segmentation
1024x1024
RTX 3090
50ms
Image segmentation
1024x1024
RTX 4090
30ms
Video (per frame)
720p
RTX 4090
45ms
Video (per frame)
1080p
A100
35ms
Model Variants (SAM2.1)
SAM2.1 introduces new sam2.1_hiera_* checkpoints with improved video tracking accuracy:
sam2.1_hiera_tiny
38M
4GB
Fastest
Good
sam2.1_hiera_tiny.pt
sam2.1_hiera_small
46M
5GB
Fast
Better
sam2.1_hiera_small.pt
sam2.1_hiera_base_plus
80M
8GB
Medium
Great
sam2.1_hiera_base_plus.pt
sam2.1_hiera_large
224M
12GB
Slower
Best
sam2.1_hiera_large.pt
Note: SAM2.1 models consistently outperform their SAM2 counterparts on video benchmarks, especially for fast-moving objects and long occlusions.
Common Problems & Solutions
Out of Memory
Problem: CUDA out of memory on long videos
Solutions:
Tracking Lost
Problem: Object tracking fails mid-video
Solutions:
Add correction points when tracking drifts
Use box prompts for better initial segmentation
Choose clearer initial frames
Slow Processing
Problem: Video processing is too slow
Solutions:
Use smaller model variant (tiny/small)
Reduce video resolution
Enable half-precision (fp16)
Process on A100 GPU
Poor Mask Quality
Problem: Segmentation edges are rough
Solutions:
Use larger model (large instead of tiny)
Add more point prompts
Combine point and box prompts
Troubleshooting
Segmentation inaccurate
Click more precisely on target object
Add multiple positive/negative points
Use box prompt for large objects
Video memory error
Process fewer frames at once
Reduce video resolution
Use streaming mode for long videos
Tracking lost
Add more prompts when object changes
Use memory bank feature
Check object isn't occluded
Slow processing
SAM2 is compute-heavy
Use A100 for long videos
Consider frame skipping
Cost Estimate
Typical CLORE.AI marketplace rates (as of 2024):
RTX 3060
~$0.03
~$0.70
~$0.12
RTX 3090
~$0.06
~$1.50
~$0.25
RTX 4090
~$0.10
~$2.30
~$0.40
A100 40GB
~$0.17
~$4.00
~$0.70
A100 80GB
~$0.25
~$6.00
~$1.00
Prices vary by provider and demand. Check CLORE.AI Marketplace for current rates.
Save money:
Use the Spot market for interruptible work — about a third of servers price spot below on-demand (median ~13% off), the rest match it
Pay with CLORE tokens
Compare prices across different providers
Next Steps
GroundingDINO - Auto-detect objects to segment
Florence-2 - Vision-language understanding
Depth Anything - Depth estimation
Last updated
Was this helpful?