# segment-anything | Meta Research | Knowledge Base | Instagit

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.

GitHub Stars: 53.6k

Repository: https://github.com/facebookresearch/segment-anything

---

## Articles

### [How SAM's Two-Way Transformer Architecture Differs from Standard Transformers](/facebookresearch/segment-anything/sam-two-way-transformer-explained)

Discover how SAM's two-way transformer architecture uses bidirectional cross-attention for efficient mask generation unlike standard transformers unidirectional self-attention.

- Tags: deep-dive
- Published: 2026-03-07

### [Limitations of the Segment Anything Model: Technical Constraints in SAM](/facebookresearch/segment-anything/sam-model-limitations)

Explore the Segment Anything Model limitations including fixed input resolution, high GPU memory needs, prompt restrictions, and accuracy issues with out-of-distribution data. Get the technical details.

- Tags: deep-dive
- Published: 2026-03-07

### [How to Integrate SAM into a Web Application: A Complete Production Guide](/facebookresearch/segment-anything/integrate-sam-web-application)

Integrate Segment Anything Model SAM into your web app. Export mask decoder to ONNX, pre compute embeddings, and run inference in browser with ONNX Runtime Web and React. A complete production guide.

- Tags: how-to-guide
- Published: 2026-03-07

### [License Details for the Segment Anything Model: Apache 2.0 Explained](/facebookresearch/segment-anything/segment-anything-model-license)

Understand the Segment Anything Model license. SAM is released under Apache 2.0, allowing commercial use, modification, and distribution. Get the details here.

- Tags: api-reference
- Published: 2026-03-07

### [How to Fine-Tune SAM for Specific Tasks: A Complete Technical Guide](/facebookresearch/segment-anything/fine-tuning-sam-for-tasks)

Learn how to fine-tune the Segment Anything Model SAM for your specific tasks. This guide details efficient methods including freezing the image encoder or full model adaptation for optimal results.

- Tags: how-to-guide
- Published: 2026-03-07

### [Minimum Requirements for Running SAM: Complete Setup Guide for the Segment Anything Model](/facebookresearch/segment-anything/sam-minimum-requirements)

Discover the minimum requirements to run the Segment Anything Model SAM. Learn about Python, PyTorch, torchvision, and model checkpoints needed for easy setup. Get started today!

- Tags: getting-started
- Published: 2026-03-07

### [How to Run SAM Locally: A Complete Guide to Segment Anything Model Inference](/facebookresearch/segment-anything/run-sam-locally)

Learn to run Segment Anything Model locally. Install the package, download a checkpoint, and use SamPredictor or SamAutomaticMaskGenerator for powerful image segmentation.

- Tags: how-to-guide
- Published: 2026-03-07

### [How to Handle Ambiguous Prompts with SAM: A Deep Dive into Segment Anything Model's Architecture](/facebookresearch/segment-anything/handling-ambiguous-prompts-sam)

Learn how the Segment Anything Model (SAM) expertly handles ambiguous prompts by generating multiple mask candidates and supporting iterative refinement. Understand SAM's architecture for clearer image segmentation.

- Tags: deep-dive
- Published: 2026-03-07

### [Performance Characteristics of SAM Models: Architecture, Speed, and Memory Analysis](/facebookresearch/segment-anything/sam-model-performance)

Explore SAM model performance characteristics. Analyze ViT-H, ViT-L, and ViT-B variants for speed, memory, and accuracy trade-offs. Optimize your segmentation tasks.

- Tags: performance
- Published: 2026-03-07

### [Can SAM Segment All Objects in an Image? A Deep Dive into Meta's Segment Anything Model](/facebookresearch/segment-anything/sam-segment-all-objects)

Discover if Meta's Segment Anything Model (SAM) can segment all objects in an image. Learn how the SamAutomaticMaskGenerator wrapper enables this capability.

- Tags: deep-dive
- Published: 2026-03-07

### [How to Load SAM Checkpoints: A Complete Guide to Segment Anything Model Weights](/facebookresearch/segment-anything/how-to-load-sam-checkpoints)

Easily load SAM checkpoints for the Segment Anything Model. Learn how to use sam_model_registry to load weights for vit_h, vit_l, and vit_b models in PyTorch.

- Tags: how-to-guide
- Published: 2026-03-07

### [How to Export SAM Models to ONNX for Deployment](/facebookresearch/segment-anything/export-sam-to-onnx)

Export SAM models to ONNX for deployment using the SamOnnxModel wrapper and export script. Convert prompt encoder and mask decoder efficiently.

- Tags: how-to-guide
- Published: 2026-03-07

### [How to Choose the Right SAM Model Variant for Your Application](/facebookresearch/segment-anything/choosing-sam-model-variant)

Find the best SAM model variant for your application. Choose vit_h for max accuracy, vit_l for balanced performance, or vit_b for real-time edge deployment based on your needs.

- Tags: best-practices
- Published: 2026-03-07

### [SAM Model Sizes Explained: vit_h, vit_l, and vit_b Comparison in Segment Anything](/facebookresearch/segment-anything/sam-model-sizes-comparison)

Explore SAM model sizes vit_h, vit_l, and vit_b. Understand the trade-offs between accuracy and computational cost for the Segment Anything Model.

- Tags: deep-dive
- Published: 2026-03-07

### [How to Use SAM for Automatic Mask Generation: A Complete Guide](/facebookresearch/segment-anything/sam-automatic-mask-generation)

Learn how to use SAM for automatic mask generation with facebookresearch segment anything. Generate segmentation masks for entire images efficiently without manual prompts. Get your complete guide now.

- Tags: how-to-guide
- Published: 2026-03-07

### [What Is the SA-1B Dataset and How Does It Train SAM?](/facebookresearch/segment-anything/sa-1b-dataset-for-sam)

Discover the SA-1B dataset, a massive collection of 1.1 billion segmentation masks on 11 million images, essential for training the Segment Anything Model (SAM). Learn how it enables promptable segmentation.

- Tags: deep-dive
- Published: 2026-03-07

### [How to Perform Box-Based Segmentation with SAM: A Complete Technical Guide](/facebookresearch/segment-anything/box-based-segmentation-with-sam)

Learn how to perform box-based segmentation with SAM. This technical guide shows you how to convert bounding box prompts into precise object masks using SAM's robust architecture.

- Tags: how-to-guide
- Published: 2026-03-07

### [How to Perform Point-Based Segmentation with SAM: A Complete Guide](/facebookresearch/segment-anything/point-based-segmentation-with-sam)

Learn how to perform point-based segmentation with SAM. This guide explains encoding clicks, combining features, and decoding masks for precise image segmentation.

- Tags: how-to-guide
- Published: 2026-03-07

### [SAM Mask Decoder Functionality: Architecture and Implementation Guide](/facebookresearch/segment-anything/sam-mask-decoder-functionality)

Uncover the SAM mask decoder functionality. Learn its architecture and implementation for pixel-accurate segmentation masks and quality scores. A detailed guide for developers.

- Tags: architecture
- Published: 2026-03-07

### [How to Encode Point and Box Prompts for SAM: Implementation Guide](/facebookresearch/segment-anything/sam-prompt-encoding-methods)

Learn how to encode point and box prompts for SAM. This guide details the PromptEncoder class, converting coordinates into high-dimensional embeddings for efficient segmentation.

- Tags: how-to-guide
- Published: 2026-03-07

### [How the SAM Image Encoder Works: ViT Architecture and Implementation](/facebookresearch/segment-anything/sam-image-encoder-explained)

Discover how the SAM image encoder, a Vision Transformer, creates dense embeddings from images using patch embedding, windowed attention, and a convolutional neck for Segment Anything.

- Tags: internals
- Published: 2026-03-07

### [SAM Architecture Explained: The Three Core Components of Meta's Segment Anything Model](/facebookresearch/segment-anything/sam-architecture-components)

Explore the SAM architecture and its three core components: Image Encoder, Prompt Encoder, and Mask Decoder. Understand how Meta's Segment Anything Model generates precise segmentation masks.

- Tags: architecture
- Published: 2026-03-07

### [How to Install the Segment Anything Model (SAM): A Complete Guide](/facebookresearch/segment-anything/how-to-install-segment-anything-model)

Install the Segment Anything Model SAM in one command using pip. Follow our complete guide for a quick setup of this powerful image segmentation tool from Meta AI.

- Tags: getting-started
- Published: 2026-03-07

