Skip to content
ModelListedExternal
Download

Sam3 Browser Int8

INT8-quantized ONNX models for running SAM3 (Segment Anything Model 3) entirely in the browser via ONNX Runtime Web.

KindOtherVersionRevision 970196b

Model source

Kind
Other
File size
34.1–466 MB
Version
vRevision 970196b
Updated
Sep 27, 2026
Downloads
0
Tasks
Image segmentation
Source
Hugging Face

Source description

SAM3 Browser INT8 — Quantized ONNX Models

INT8-quantized ONNX models for running SAM3 (Segment Anything Model 3) entirely in the browser via ONNX Runtime Web.

Files

FileSizeDescription
sam3_image_encoder.onnx466 MBViT backbone — encodes the input image into feature maps
sam3_language_encoder.onnx387 MBCLIP text encoder — converts text prompts into embeddings
sam3_decoder.onnx35 MBDETR-style decoder — produces boxes, scores, and pixel masks
clip_tokenizer.json1.5 MBCLIP BPE tokenizer vocabulary (encoder + merge table + byte encoder)
Total~889 MB

Tokenizer

clip_tokenizer.json contains the full CLIP BPE tokenizer data needed to tokenize text prompts for the language encoder. It includes:

  • encoder: BPE token → integer ID mapping (~49,408 entries)
  • merges: BPE merge rules (~48,894 pairs)
  • byte_encoder: byte-to-unicode mapping for UTF-8 handling

This is extracted from OpenAI's CLIP bpe_simple_vocab_16e6.txt.gz and packaged as JSON for browser use. Load it at runtime (~500 KB gzipped by CDN) and use it to tokenize prompts into int64 token sequences of length 32, padded with [START=49406, ...tokens..., END=49407, 0, 0, ...].

Quantization

Dynamic INT8 quantization via onnxruntime.quantization.quantize_dynamic with QUInt8 weights. Original FP32 models totaled ~3.5 GB.

Quality is preserved: the quantized pipeline scores 0.9495 on a test image (vs 0.9471 for FP32).

Usage

These models are designed for browser inference. Load them with ONNX Runtime Web:

Pipeline

  1. Tokenizer: text prompt → clip_tokenizer.json → int64[1, 32] (CLIP BPE tokens)
  2. Image encoder: input image (uint8, shape [3, 1008, 1008]) → 6 output tensors (vision pos encodings + backbone FPN features)
  3. Language encoder: input tokens (int64, shape [1, 32]) → text_attention_mask, text_memory, text_embeds
  4. Decoder: combines encoder outputs + prompt tensors → boxes, scores, masks

Decoder inputs

InputTypeShapeSource
original_heightint64scalarOriginal image height
original_widthint64scalarOriginal image width
vision_pos_enc_2float32from encoderImage encoder output
backbone_fpn_0/1/2float32from encoderImage encoder outputs
language_maskfloat32from lang encoder= text_attention_mask
language_featuresfloat32from lang encoder= text_memory
box_coordsfloat32[1, 1, 4]Zeros for text-only prompting
box_labelsint64[1, 1]Ones
box_masksbool[1, 1]Ones

Performance

EnvironmentScoreTotal time
Python FP32 (CPU)0.94717.6s
Python INT8 (CPU)0.94954.5s
Browser WASM0.940294.7s
Browser WebGPU~0.94 (est.)~6-18s (est.)

Source

Original SAM3 ONNX models from vietanhdev/segment-anything-3-onnx-models, quantized for browser deployment.

Live demo

rusen.ai/demos/segment-anything

Sources

1 source
Hugging FacePrimaryVersion 970196bb75edfbcdab59567ee017673a4c53adc7
huggingface.co/rusen/sam3-browser-int8/tree/970196bb75edfbcdab59567ee017673a4c53adc7

Verified Sep 27

Model artifacts

7 artifacts

compact-448/sam3_decoder.onnx

onnx · 34.1 MB · SHA-256 3eed5b9d033b…3bff · Hugging Face

Download

compact-448/sam3_image_encoder_fp16.onnx

onnx · 441 MB · SHA-256 32113f9ee910…e4a2 · Hugging Face

Download

compact-448/sam3_language_encoder.onnx

onnx · 339 MB · SHA-256 75e5915fc017…5a29 · Hugging Face

Download

sam3_decoder.onnx

onnx · 34.7 MB · SHA-256 952cbb57d0ff…8a2d · Hugging Face

Download

sam3_image_encoder_fp16.onnx

onnx · 447 MB · SHA-256 7bd73f0fad77…23df · Hugging Face

Download

sam3_image_encoder.onnx

onnx · 466 MB · SHA-256 0bd6d454c60f…cc6a · Hugging Face

Download

sam3_language_encoder.onnx

onnx · 387 MB · SHA-256 548560907952…4170 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: apache-2.0 tags: - sam3 - segment-anything - onnx - int8 - browser - webgpu - computer-vision - segmentation pipeline_tag: image-segmentation --- # SAM3 Browser INT8 — Quantized ONNX Models INT8-quantized ONNX models for running [SAM3 (Segment Anything Model 3)](https://github.com/facebookresearch/sam3) entirely in the browser via [ONNX Runtime Web](https://onnxruntime.ai/docs/tutorials/web/). ## Files | File | Size | Description | |---|---|---| | `sam3_image_encoder.onnx` | 466 MB | ViT backbone — encodes the input image into feature maps | | `sam3_language_encoder.onnx` | 387 MB | CLIP text encoder — converts text prompts into embeddings | | `sam3_decoder.onnx` | 35 MB | DETR-style decoder — produces boxes, scores, and pixel masks | | `clip_tokenizer.json` | 1.5 MB | CLIP BPE tokenizer vocabulary (encoder + merge table + byte encoder) | | **Total** | **~889 MB** | | ## Tokenizer `clip_tokenizer.json` contains the full CLIP BPE tokenizer data needed to tokenize text prompts for the language encoder. It includes: - **`encoder`**: BPE token → integer ID mapping (~49,408 entries) - **`merges`**: BPE merge rules (~48,894 pairs) - **`byte_encoder`**: byte-to-unicode mapping for UTF-8 handling This is extracted from OpenAI's CLIP `bpe_simple_vocab_16e6.txt.gz` and packaged as JSON for browser use. Load it at runtime (~500 KB gzipped by CDN) and use it to tokenize prompts into `int64` token sequences of length 32, padded with `[START=49406, ...tokens..., END=49407, 0, 0, ...]`. ## Quantization Dynamic INT8 quantization via `onnxruntime.quantization.quantize_dynamic` with `QUInt8` weights. Original FP32 models totaled ~3.5 GB. Quality is preserved: the quantized pipeline scores **0.9495** on a test image (vs 0.9471 for FP32). ## Usage These models are designed for browser inference. Load them with ONNX Runtime Web: ### Pipeline 1. **Tokenizer**: text prompt → `clip_tokenizer.json` → `int64[1, 32]` (CLIP BPE tokens) 2. **Image encoder**: input `image` (uint8, shape `[3, 1008, 1008]`) → 6 output tensors (vision pos encodings + backbone FPN features) 3. **Language encoder**: input `tokens` (int64, shape `[1, 32]`) → `text_attention_mask`, `text_memory`, `text_embeds` 4. **Decoder**: combines encoder outputs + prompt tensors → `boxes`, `scores`, `masks` ### Decoder inputs | Input | Type | Shape | Source | |---|---|---|---| | `or...

Source context: 0 downloads · 1 likes · Pipeline image-segmentation · Repo rusen/sam3-browser-int8