Models · Promptable segmentation
Segment Anything 3 (SAM 3), image
Segment Anything 3: masks for every object that matches a text or example prompt, as well as clicks and boxes. Meta's SAM License applies; commercially usable under it.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
sam3 | synthetic (1024x1024) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 695 281 179 116 168 89.5 (image encoder only) | 3865 / 3934 5255 / 5334 1922 / 2004 2019 / 2264 1910 / 2004 1122 (engine) |
Details
- Original code: https://github.com/facebookresearch/sam3 at
0570b3a - Code licence: LicenseRef-SAM-License AND Apache-2.0 (permissive); files:
LICENSE,LICENSE-transformers - Weights licence: LicenseRef-SAM-License
- Licence evidence: https://huggingface.co/facebook/sam3/blob/main/LICENSE (SAM License, Nov 19 2025); the weights are gated: download them from Meta's Hugging Face repo after accepting the licence and point FASTFORKS_WEIGHTS_PATH at the local copy; fastforks never mirrors them
- Training data: the SA-Co data engine's image and video annotations plus public and internal datasets per the paper; not released as one dataset
- Licence note: The weights use Meta's SAM License, not Apache-2.0; its terms were not re-checked here.
- Kernel libraries:
fastbb,cudnn_hacc - Variants:
sam3 - Outputs: boxes, scores, masks
- Input size: any H x W >= 1, resized inside to the fixed encoder input 1008x1008 (the default export size)
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
sam31080x1920 (1.9 GiB peak allocated, 2.1 reserved) sam31024x1024, first call: portable + torch.compile 20 s (cold Inductor cache), TensorRT fp16 54 s (ONNX + engine).sam3original 1024x1024: torch.autocast(fp16) around the forwardsam3load / first call: original 1.12 s / 0.957 s (840x1297), portable 2.95 s / 0.181† s, kernels 0.7† s / 0.116† 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 text prompt (the COCO class name) per class in the image; the top 100 instances go to pycocotools COCOeval. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
sam3 | COCO val2017, every 10th image, class-name prompts, box / mask mAP | 52.54 / 44.56 | 52.54 / 44.54 | 52.79 / 45.13 | 52.83 / 45.14 | original = transformers Sam3Model, the port this code follows |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Parity
CPU, float32: max |diff| <= 0.0005 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.35 and p99 <= 2.0 (absolute error of the output boxes).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
sam3 | 0.13504 / 0.77076 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fastbb@7d058322634d:sm_120 |