Models · Promptable segmentation

Segment Anything 2.1 (SAM 2.1), image

Segment Anything 2.1 in image mode: masks from clicks, boxes or mask prompts, in four sizes. Commercially usable.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
sam2.1-hiera-tinysynthetic (1024x1024)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
66.3
38.0
16.6
13.9
14.2
8.56 (image encoder only)
622 / 676
577 / 636
304 / 382
316 / 362
270 / 322
266 (engine)
sam2.1-hiera-smallsynthetic (1024x1024)original (fp32)
original
portable
kernels
74.8
41.8
18.8
15.6
649 / 698
618 / 662
318 / 366
330 / 386
sam2.1-hiera-base-plussynthetic (1024x1024)original (fp32)
original
portable
kernels
107
47.2
32.0
25.1
830 / 868
823 / 870
412 / 464
426 / 524
sam2.1-hiera-largesynthetic (1024x1024)original (fp32)
original
portable
kernels
242
86.4
68.0
48.8
1474 / 1518
1656 / 1724
742 / 768
760 / 828
Details
  • Original code: https://github.com/facebookresearch/sam2 at 2b90b9f
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0
  • Licence evidence: https://github.com/facebookresearch/sam2/blob/main/README.md (License section: model checkpoints and code under Apache 2.0)
  • Training data: SA-1B and the SA-V video dataset (plus internal data) per the paper; SA-V itself is under CC BY 4.0, SA-1B under its research licence
  • Kernel libraries: dpt_fused
  • Variants: sam2.1-hiera-tiny, sam2.1-hiera-small, sam2.1-hiera-base-plus, sam2.1-hiera-large
  • Outputs: pred_masks, iou_scores
  • Input size: any H x W >= 1, resized inside to the fixed encoder input 1024x1024 (the default export size)
  • Tested up to (portable, fp16, RTX 5060 Ti 16 GB): sam2.1-hiera-tiny 1080x1920 (0.3 GiB peak allocated, 0.4 reserved); sam2.1-hiera-small 1080x1920 (0.3 GiB peak allocated, 0.4 reserved); sam2.1-hiera-base-plus 1080x1920 (0.4 GiB peak allocated, 0.6 reserved); sam2.1-hiera-large 1080x1920 (0.7 GiB peak allocated, 0.9 reserved)
  • sam2.1-hiera-tiny 1024x1024, first call: portable + torch.compile 13 s (cold Inductor cache), TensorRT fp16 34 s (ONNX + engine).
  • sam2.1-hiera-tiny original 1024x1024: torch.autocast(float16) around the call
  • sam2.1-hiera-small original 1024x1024: torch.autocast(float16) around the call
  • sam2.1-hiera-base-plus original 1024x1024: torch.autocast(float16) around the call
  • sam2.1-hiera-large original 1024x1024: torch.autocast(float16) around the call
  • sam2.1-hiera-tiny load / first call: original 0.41 s / 0.147 s, portable 0.25 s / 0.017† s, kernels 0.11† s / 0.014† s
  • sam2.1-hiera-small load / first call: original 0.48 s / 0.136 s, portable 0.36 s / 0.019† s, kernels 0.13† s / 0.016† s
  • sam2.1-hiera-base-plus load / first call: original 0.74 s / 0.143 s, portable 0.43 s / 0.032† s, kernels 0.19† s / 0.025† s
  • sam2.1-hiera-large load / first call: original 1.95 s / 0.184 s, portable 1.1 s / 0.068† s, kernels 0.39† s / 0.049† s
  • † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
  • Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls

Measured

One point per ground-truth instance (the interior point farthest from the border); IoU of the best-scored of 3 masks / of the single mask. Original = the original code named under Details, same checkpoint and protocol.

variantdatasetoriginal fp32original fp16portablekernelsnote
sam2.1-hiera-tinyCOCO val2017, every 10th image, point prompts, mIoU best of 3 / single mask %57.63 / 57.6957.56 / 57.6457.62 / 57.7257.61 / 57.77
sam2.1-hiera-smallCOCO val2017, every 10th image, point prompts, mIoU best of 3 / single mask %59.39 / 58.4659.34 / 58.4259.38 / 58.4959.38 / 58.47
sam2.1-hiera-base-plusCOCO val2017, every 10th image, point prompts, mIoU best of 3 / single mask %58.79 / 58.6758.73 / 58.5758.81 / 58.7158.82 / 58.73
sam2.1-hiera-largeCOCO val2017, every 10th image, point prompts, mIoU best of 3 / single mask %64.88 / 64.7164.77 / 64.7364.86 / 64.6864.87 / 64.70

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 3 % and p99 <= 15 % of the reference's median |value| (absolute error of the output pred_masks).

variantkernels error vs original, mean / p99GPU, torchkernels used
sam2.1-hiera-tiny0.00122 / 0.00428RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120
sam2.1-hiera-small0.00539 / 0.01677RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120
sam2.1-hiera-base-plus0.00245 / 0.00842RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120
sam2.1-hiera-large0.01872 / 0.08865RTX 5060 Ti, torch 2.14.1+cu130dpt_fused@48e0065bb7cf:sm_120