alt.freeweights.vision / sam-vit-base-ONNX
From: onnx-community <huggingface.co/onnx-community>Newsgroups: alt.freeweights.visionSubject:

sam-vit-base-ONNX

Date: 2026-11-15Commit: 0a968b6Signed: 2DC28CC7B26A283B ✓

Mask generation model. Onnx weights, 1.09 GB in all. Published by onnx-community under Apache-2.0.

vision1.09GBsam-vit-base-ONNXonnxpermissive
FactsParamsnot statedSize1.09 GBFormatsonnxTaskmask generationLicenseApache-2.0From sourcepermissive
$ fw get onnx-community/sam-vit-base-ONNX
# manifest sha256 773eb877b9ee… · 1.09 GB · 20 files
$ fw verify ./sam-vit-base-ONNX onnx-community/sam-vit-base-ONNX
From sourceHosted (signed)onnx-community/sam-vit-base-ONNXLast check: 2026-11-15 05:23 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Quantized of sam-vit-base.

Runs withOpenVINOUltralyticsConvert withOliveONNXOptimumScan withModelScan

Overview

Size
1.09 GB
Weights
2.83 MB (smallest of 16 ONNX variants)
Parameters
not stated
Formats
onnx
Task
mask generation
License
Apache-2.0 (permissive)
Files
20, each with a sha256
Publisher
onnx-community
Added
2026-11-15
Section
alt.freeweights.vision
Lineage

Original release from the publisher.

Base model: facebook/sam-vit-base

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 05:23 UTCpassed

Model card

From the publisher at commit 0a968b6. Shown as plain text with links; images open at the publisher.

sam-vit-base (ONNX)#

This is an ONNX version of facebook/sam-vit-base. It was automatically converted and uploaded using this Hugging Face Space.

Usage with Transformers.js#

See the pipeline documentation for mask-generation: https://huggingface.co/docs/transformers.js/api/pipelines


Model Card for Segment Anything Model (SAM) - ViT Base (ViT-B) version#

Image: Model architecture Detailed architecture of Segment Anything Model (SAM).

Table of Contents#

  1. TL;DR
  2. Model Details
  3. Usage
  4. Citation

TL;DR#

Link to original repository

The Segment Anything Model (SAM) produces high quality object masks from input prompts such as points or boxes, and it can be used to generate masks for all objects in an image. It has been trained on a dataset of 11 million images and 1.1 billion masks, and has strong zero-shot performance on a variety of segmentation tasks. The abstract of the paper states:

We introduce the Segment Anything (SA) project: a new task, model, and dataset for image segmentation. Using our efficient model in a data collection loop, we built the largest segmentation dataset to date (by far), with over 1 billion masks on 11M licensed and privacy respecting images. The model is designed and trained to be promptable, so it can transfer zero-shot to new image distributions and tasks. We evaluate its capabilities on numerous tasks and find that its zero-shot performance is impressive -- often competitive with or even superior to prior fully supervised results. We are releasing the Segment Anything Model (SAM) and corresponding dataset (SA-1B) of 1B masks and 11M images at https://segment-anything.com to foster research into foundation models for computer vision.

Disclaimer: Content from this model card has been written by the Hugging Face team, and parts of it were copy pasted from the original SAM model card.

Model Details#

The SAM model is made up of 3 modules:

  • The VisionEncoder: a VIT based image encoder. It computes the image embeddings using attention on patches of the image. Relative Positional Embedding is used.
  • The PromptEncoder: generates embeddings for points and bounding boxes
  • The MaskDecoder: a two-ways transformer which performs cross attention between the image embedding and the point embeddings (->) and between the point embeddings and the image embeddings. The outputs are fed
  • The Neck: predicts the output masks based on the contextualized masks produced by the MaskDecoder.

Usage#

Prompted-Mask-Generation#

from PIL import Image
import requests
from transformers import SamModel, SamProcessor

model = SamModel.from_pretrained("facebook/sam-vit-base")
processor = SamProcessor.from_pretrained("facebook/sam-vit-base")

img_url = "https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png"
raw_image = Image.open(requests.get(img_url, stream=True).raw).convert("RGB")
input_points = [[[450, 600]]] # 2D localization of a window
inputs = processor(raw_image, input_points=input_points, return_tensors="pt").to("cuda")
outputs = model(**inputs)
masks = processor.image_processor.post_process_masks(outputs.pred_masks.cpu(), inputs["original_sizes"].cpu(), inputs["reshaped_input_sizes"].cpu())
scores = outputs.iou_scores

Among other arguments to generate masks, you can pass 2D locations on the approximate position of your object of interest, a bounding box wrapping the object of interest (the format should be x, y coordinate of the top right and bottom left point of the bounding box), a segmentation mask. At this time of writing, passing a text as input is not supported by the official model according to the official repository. For more details, refer to this notebook, which shows a walk throught of how to use the model, with a visual example!

Automatic-Mask-Generation#

The model can be used for generating segmentation masks in a "zero-shot" fashion, given an input image. The model is automatically prompt with a grid of 1024 points which are all fed to the model.

The pipeline is made for automatic mask generation. The following snippet demonstrates how easy you can run it (on any device! Simply feed the appropriate points_per_batch argument)

from transformers import pipeline
generator =  pipeline("mask-generation", device = 0, points_per_batch = 256)
image_url = "https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png"
outputs = generator(image_url, points_per_batch = 256)

Now to display the image:

import matplotlib.pyplot as plt
from PIL import Image
import numpy as np

def show_mask(mask, ax, random_color=False):
    if random_color:
        color = np.concatenate([np.random.random(3), np.array([0.6])], axis=0)
    else:
        color = np.array([30 / 255, 144 / 255, 255 / 255, 0.6])
    h, w = mask.shape[-2:]
    mask_image = mask.reshape(h, w, 1) * color.reshape(1, 1, -1)
    ax.imshow(mask_image)
    

plt.imshow(np.array(raw_image))
ax = plt.gca()
for mask in outputs["masks"]:
    show_mask(mask, ax=ax, random_color=True)
plt.axis("off")
plt.show()

Citation#

If you use this model, please use the following BibTeX entry.

@article{kirillov2023segany,
  title={Segment Anything},
  author={Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Doll{\'a}r, Piotr and Girshick, Ross},
  journal={arXiv:2304.02643},
  year={2023}
}

Files

20 files · 1.09 GBWeights 2.83 MB (smallest of 16 ONNX variants). Sizes and sha256 from the signed manifest.
Hide all 20 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md7.24 KB8c39fee3db7ad1a4ffcea136345f284835aac53db3249cde4b98c1b965aa6fc3
config.json1.54 KBa8b2311d38829578962c8e27398bd17796d99efc4a76b958f47024522e149a2e
onnx/prompt_encoder_mask_decoder.onnx16.5 MB4bdb40966f844fbee06c34628c38d0b60d99225f1340acfd0c0b0de6b58a360c
onnx/prompt_encoder_mask_decoder_bnb4.onnx3.16 MB92951ac90f7e2a902c8f450b0b5d6f82c81208de33b5a98348081f3534315035
onnx/prompt_encoder_mask_decoder_fp16.onnx8.54 MB304d08dc46b625eed805495664d14a332d036e434a02a27cf9234134df835d5e
onnx/prompt_encoder_mask_decoder_int8.onnx4.82 MBfdfca4f259255b381143323a3c8a4533c42f39610401809b924481d23385fcc8
onnx/prompt_encoder_mask_decoder_q4.onnx3.16 MB92951ac90f7e2a902c8f450b0b5d6f82c81208de33b5a98348081f3534315035
onnx/prompt_encoder_mask_decoder_q4f16.onnx2.83 MB2310795584322034c56f9bb413338282c1d850cb3d44f0b043e69014f90df359
onnx/prompt_encoder_mask_decoder_quantized.onnx4.82 MBfdfca4f259255b381143323a3c8a4533c42f39610401809b924481d23385fcc8
onnx/prompt_encoder_mask_decoder_uint8.onnx4.82 MB4920b9721ca926f5e64b81c7d747869cf10fc31c09936bf74fa47aaa3858d12d
onnx/vision_encoder.onnx359 MB5b9cf89ce0cf66d162b305060e0ed4afd3b01a01f450300be935b6d5df3739fe
onnx/vision_encoder_bnb4.onnx72.7 MB16494b57ad3c0133a24a17fa04bd18c5aa94dcf53d23bebfb4710eee4b9782e6
onnx/vision_encoder_fp16.onnx180 MBea8612490fa7b635285640dbcc3fa6eb3e280e9b9a47253dcf2228edeafdc671
onnx/vision_encoder_int8.onnx101 MBaea6fa5ac99e609530f37ecadcbbc16e448eef9f7940e7ddbd6c5226edb19f2c
onnx/vision_encoder_q4.onnx72.7 MB16494b57ad3c0133a24a17fa04bd18c5aa94dcf53d23bebfb4710eee4b9782e6
onnx/vision_encoder_q4f16.onnx58.3 MB53fbd78e59cba8513e8de22fdd33db7b8aa52233c5d314de362e1f05e5c73019
onnx/vision_encoder_quantized.onnx101 MBaea6fa5ac99e609530f37ecadcbbc16e448eef9f7940e7ddbd6c5226edb19f2c
onnx/vision_encoder_uint8.onnx101 MB919957399ae8575c0d9b3df47c10a904eaf237f91925a01b1fdc47de6a9321ae
preprocessor_config.json574 Bde84590cfab4d1514f8b1a04d9c61b14f56c2a9f3af31c656a44b046465b73a5
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
0a968b695a pinned now2026-11-15 05:23 UTC20 files · 1.09 GB

Use it

$ fw get onnx-community/sam-vit-base-ONNX
# manifest sha256 773eb877b9ee… · 1.09 GB · 20 files
$ fw verify ./sam-vit-base-ONNX onnx-community/sam-vit-base-ONNX
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/onnx-community/sam-vit-base-ONNX.json --dir ./sam-vit-base-ONNX $ python3 fw.py verify ./sam-vit-base-ONNX ./onnx-community__sam-vit-base-ONNX.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download onnx-community/sam-vit-base-ONNX --revision 0a968b695af3aa98829b5daadc574daf7231c778 --local-dir ./sam-vit-base-ONNX

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
8c39fee3db7ad1a4ffcea136345f284835aac53db3249cde4b98c1b965aa6fc3
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: onnx-community <huggingface.co/onnx-community>Newsgroups: alt.freeweights.visionSubject: sam-vit-base-ONNXDate: 2026-11-15Commit: 0a968b6Signed: 2DC28CC7B26A283B ✓
Upstream
onnx-community/sam-vit-base-ONNX
Pinned commit
0a968b695af3aa98829b5daadc574daf7231c778
Manifest
sam-vit-base-ONNX.json · .minisig
Manifest sha256
773eb877b9eede04002e8d1167810e6d54ef52b07edc88b37c6ef9b01307266a
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 05:23 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/onnx-community/sam-vit-base-ONNX.json $ curl -O https://freeweights.allternit.com/manifests/onnx-community/sam-vit-base-ONNX.json.minisig $ minisign -Vm sam-vit-base-ONNX.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

facebook/sam-vit-base · this model is a quantization of it

No model in the catalog names this one as its parent.

Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download onnx-community/sam-vit-base-ONNX
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. sam-vit-base-ONNX.json. Provenance. Takedown history: none.
From: dima806 <huggingface.co/dima806>Subject: ai_vs_real_image_detection
From: legekka <huggingface.co/legekka>Subject: AI-Anime-Image-Detector-ViT
From: onnx-community <huggingface.co/onnx-community>Subject: AI-Anime-Image-Detector-ViT-ONNX
From: AICodexLab <huggingface.co/AICodexLab>Subject: answerdotai-ModernBERT-base-ai-detector
From: onnx-community <huggingface.co/onnx-community>Subject: answerdotai-ModernBERT-base-ai-detector-ONNX
From: onnx-community <huggingface.co/onnx-community>Subject: bart-large-cnn-ONNX