FastSAM: 50x Faster Segment Anything Model

FastSAM: The 50x Faster Segment Anything Revolution

Lightning-Fast Performance with SAM-Quality Results

FastSAM from CASIA-LMC-Lab redefines image segmentation. Trained on just 2% of the SA-1B dataset, this CNN-based model matches Meta's Segment Anything (SAM) performance while running 50x faster.

Key Stats: - 68M parameters (vs SAM-H's 0.6G) - 40ms inference regardless of prompt count - 2608MB GPU memory (vs SAM-H's 7060MB)

πŸš€ 4 Powerful Prompt Modes

# Everything mode - segments everything
python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg

# Text prompt
python Inference.py --img_path ./images/dogs.jpg --text_prompt "the yellow dog"

# Box prompt [x,y,w,h]
python Inference.py --box_prompt "[[570,200,230,400]]"

# Points prompt
python Inference.py --point_prompt "[[520,360],[620,300]]" --point_label "[1,0]"

πŸ› οΈ Quick Start (5 Minutes)

git clone https://github.com/CASIA-LMC-Lab/FastSAM.git
cd FastSAM
conda create -n FastSAM python=3.9
conda activate FastSAM
pip install -r requirements.txt
# Download FastSAM.pt checkpoint
python Inference.py --model_path ./weights/FastSAM.pt --img_path ./images/dogs.jpg

🌐 Live Demos Available

πŸ“Š Benchmark Results

Method Params 1pt 10pts 100pts E(64x64)
SAM-H 0.6G 446 464 627 6972
SAM-B 136M 110 125 230 5417
FastSAM 68M 40 40 40 40

πŸ”¬ Real-World Applications

  1. Edge Detection - BSDS500: ODS 0.750 (vs SAM 0.768)
  2. Object Proposals - COCO AR@1000: 63.7 (vs SAM-H 67.7)
  3. Instance Segmentation - COCO AP: 0.379
  4. Downstream Tasks: Anomaly Detection, Salient Object Detection, Building Extraction

🎯 Why Choose FastSAM?

βœ… Production Ready - YOLOv8 Model Hub integration
βœ… Developer Friendly - Python API + web demos βœ… Hardware Efficient - Runs on consumer GPUs βœ… Extensible - Training code released βœ… Community Driven - 8.3k stars, 26 contributors

Recent Updates (June 2024)

  • Edge quality improvements merged to Ultralytics YOLOv8
  • HuggingFace demo updated
  • TensorRT optimization available
  • Semantic FastSAM extension

FastSAM proves you don't need massive ViT models for state-of-the-art segmentation. Perfect for real-time applications where speed matters most.

GitHub Repo | Try Demo Now β†’

Original Article: View Original

Share this article