Meta's Segment Anything Model 2.1 (Hiera-Large backbone) quantized to INT8 for real-time robotic segmentation. 1.7x smaller — from 1.7 GB to 1.0 GB — with both image and video segmentation capabilities preserved.
This model is part of the RobotFlowLabs model library, built for the ANIMA agentic robotics platform — a modular ROS2-native AI system that brings foundation model intelligence to real robots operating in the real world.
Why This Model Exists
Robotic manipulation and navigation require pixel-precise understanding of the scene. SAM2 is the state-of-the-art for promptable segmentation — given a point, box, or mask prompt, it segments any object in images or tracks it through video. But at 1.7 GB, deploying SAM2 alongside other perception models on edge hardware eats precious VRAM.
We quantized SAM2.1 to INT8 and exported weights in SafeTensors format so robots can run segmentation in real-time alongside depth estimation, feature extraction, and action generation — all on a single edge GPU.
Quantized on an NVIDIA L4 24GB GPU using INT8 dynamic quantization with SafeTensors export.
Metric
Original
INT8 Quantized
Change
Total Size
1,713 MB
1,038 MB
1.7x smaller
INT8 Weights
—
211 MB
Quantized linear layers
SafeTensors
—
828 MB
Full model weights
Quantization
FP32
INT8 Dynamic
Per-tensor symmetric
Format
PyTorch
SafeTensors + INT8 .pt
Dual format
Why SafeTensors instead of ONNX? SAM2 uses custom CUDA operations (roi_align, deformable attention) that aren't supported by the ONNX standard. SafeTensors provides fast, safe loading directly into PyTorch with zero-copy memory mapping.
Included Files
sam2.1-hiera-large-int8/
├── model_int8.pt # 211 MB — INT8 quantized state dict
├── model.safetensors # 828 MB — Full model in SafeTensors format
├── config.json # Model configuration
├── preprocessor_config.json # Image preprocessing config
└── README.md # This file
Quick Start
PyTorch (SafeTensors)
python
1from transformers import Sam2Model, Sam2Processor
2import torch
34# Load with SafeTensors (automatic)5model = Sam2Model.from_pretrained("robotflowlabs/sam2.1-hiera-large-int8")6processor = Sam2Processor.from_pretrained("facebook/sam2.1-hiera-large")78model.to("cuda").eval()910# Segment with point prompt11inputs = processor(12 images=image,13 input_points=[[[500,375]]],# (x, y) point prompt14 return_tensors="pt"15).to("cuda")1617with torch.no_grad():18 outputs = model(**inputs)1920masks = processor.post_process_masks(21 outputs.pred_masks,22 inputs["original_sizes"],23 inputs["reshaped_input_sizes"]24)
ANIMA is a modular, ROS2-native agentic robotics platform developed by RobotFlowLabs. It combines 58 specialized AI modules — from perception and planning to manipulation and safety — into a unified system that enables robots to understand, reason, and act in unstructured real-world environments.
Every foundation model in ANIMA must run on edge hardware (Jetson Orin, industrial PCs) under real-time constraints. That's why we built FORGE — our compression and distillation pipeline — and why we're releasing optimized model variants publicly.
We believe the robotics community deserves production-ready models, not just research checkpoints.
1@article{ravi2024sam2,
2 title={SAM 2: Segment Anything in Images and Videos},
3 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 Rolber, Chloe and Gustafson, Laura and others},
4 journal={arXiv preprint arXiv:2408.00714},
5 year={2024}
6}