AI SeedbankHelp preserve open and free AI for humanity's future

← All models

facebook_sam-vit-huge

facebook · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


license: apache-2.0 tags:

  • vision

Model Card for Segment Anything Model (SAM) - ViT Huge (ViT-H) version

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-huge")
processor = SamProcessor.from_pretrained("facebook/sam-vit-huge")

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()

This should give you the following

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}
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:9ab4a3bac7abde6b4abcf361f31a7a2148c54f8c&dn=facebook_sam-vit-huge

Open magnet in torrent client · infohash 9ab4a3bac7abde6b4abcf361f31a7a2148c54f8c

Files & hashes

PathSizesha1sha256
README.md6.7 KB (6,886 B)f8262b9d812fbba6dced46af33cd32c0560d5d6e067801b7acf08ef0a95b3cde3adbf5997ab06c3afddb61bedf99f805cccf0ecb
config.json6.4 KB (6,569 B)97290178b40b269ecc23cb13c50e44c41c222df05ee4455a3a2a8b3728a739e6c2e4a1bf6920c83b2177affeb623fa8ec7d4ad82
model.safetensors2.39 GB (2,564,432,288 B)e888c050212ffb6d046e86c0da75c35e1e2aa036edfb0462392541fca9af44ff039bfb32dbd0c939997f3abb77a26e23af7afd7c
preprocessor_config.json466 B (466 B)732fbaf0c512b97d8d9161f51bc157bfb2873d12225545a743c654e3c495ec6f545a0eaba57c8ba3fbbd8483b3cb1c0fc58db517
pytorch_model.bin2.39 GB (2,564,565,013 B)4d731def2619a87b9bb333ff3979d6db94126cb69a14fd58481d203300024d94128edfce246b4b0db7e0b548ed52bf63578cbc38

Cite this release

Canonical URL
https://aiseedbank.org/models/facebook_sam-vit-huge/
Slug
facebook_sam-vit-huge
Infohash
9ab4a3bac7abde6b4abcf361f31a7a2148c54f8c
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: facebook_sam-vit-huge.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositoryfacebook/sam-vit-huge
Revision (pinned)87aecf0df4ce6b30cd7de76e87673c49644bdf67
Fetched at2026-09-03T22:46:49Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-03T22:47:53Z

apache-2.04.78 GB (5,129,011,222 bytes)transformerspytorchsafetensorssammask-generationvisionendpoints_compatible1 language (tf)paper: 2304.02643