--- license: other library_name: onnxruntime pipeline_tag: image-segmentation tags: - segment-anything - sam - sam2 - sam3 - mobilesam - efficientsam - onnx - onnxruntime --- # SAMExporter validated ONNX models Real, structurally checked ONNX artifacts for [`samexporter`](https://github.com/vietanhdev/samexporter). These files are published by NRL.ai so the AnyLearning and SAMExporter documentation can use stable, revisioned model links. ## Available artifacts | Directory | Prompt types | Source | Terms | |---|---|---|---| | `sam_vit_b/` | point, rectangle | Meta SAM ViT-B | Apache-2.0 | | `mobile_sam/` | point, rectangle | MobileSAM TinyViT | Apache-2.0 | | `efficient_sam_ti/` | point, rectangle | EfficientSAM-Ti official ONNX | Apache-2.0 | | `efficient_sam_s/` | point, rectangle | EfficientSAM-S official ONNX | Apache-2.0 | | `sam2_1_hiera_tiny/` | point, rectangle, mask refinement | Meta SAM 2.1 Tiny | Apache-2.0 | | `sam3/` | text, positive/negative geometry | Meta SAM3 | SAM License (included) | Each directory contains its applicable upstream license. This repository uses `license: other` because SAM3 is distributed under Meta's SAM License while the other five families are Apache-2.0. Use and redistribution remain subject to the license in each directory. No source checkpoints or training datasets are included. ## Download Download only the family you need: ```bash hf download nrl-ai/samexporter-onnx-models \ --include "mobile_sam/*" \ --local-dir output_models ``` Or download every family: ```bash hf download nrl-ai/samexporter-onnx-models --local-dir output_models ``` SAM3 uses ONNX external data: keep `sam3_decoder.onnx` and `sam3_decoder.onnx.data` together in the same directory. ## Validation - Every ONNX graph passes `onnx.checker.check_model(path)` with external data resolved from its published directory. - SAM ViT-B, MobileSAM, SAM 2.1 Tiny, and SAM3 were exported from real official checkpoints; EfficientSAM-Ti and EfficientSAM-S are the official upstream split ONNX pairs. - Point and rectangle results were run with ONNX Runtime CPU on the landscape truck and portrait plant images in the SAMExporter repository. - Full-resolution overlays and sibling resource logs are retained in [`visual_results/`](https://github.com/vietanhdev/samexporter/tree/main/visual_results). Exact file digests are listed in `CHECKSUMS.sha256`. The export provenance is listed in `PROVENANCE.md`. ## Runtime ```bash pip install "samexporter[runtime-cpu]" python -m samexporter.inference \ --sam_variant sam \ --encoder_model output_models/mobile_sam/mobile_sam.encoder.onnx \ --decoder_model output_models/mobile_sam/mobile_sam.decoder.onnx \ --image image.jpg \ --prompt prompt.json \ --output result.png ``` See the [`samexporter` documentation](https://github.com/vietanhdev/samexporter#readme) for family-specific conversion, provider, prompt, and performance guidance.