MobileSAM β€” ONNX (image encoder + single-mask decoder)

Tap or box an object, get its mask: MobileSAM (Chaoning Zhang et al., "Faster Segment Anything: Towards Lightweight SAM for Mobile Applications", 2023 β€” https://github.com/ChaoningZhang/MobileSAM), a TinyViT image encoder distilled from SAM with SAM's prompt encoder and mask decoder. The weights are MobileSAM's (Apache-2.0); the ONNX export is Acly's (https://huggingface.co/Acly/MobileSAM, MIT), mirrored here unchanged and pinned by hash for the MovieZam video editor ("cut out any object", where the mask is a prior for a graph cut that follows the object through a clip).

Files

file bytes SHA-256
mobile_sam_image_encoder.onnx 28,157,093 580f5fb648ea1062c0aabc26217aed56921985f03f0cbbd852bba81d760cc749
sam_mask_decoder_single.onnx 16,501,323 93915fc7c993ab9d59ab8c9ccd3bce37f7509c81ab4150a74abd4d2abbd8570d

Encoder. Input input_image float [H, W, 3], RGB 0..255, already RESIZED so the longer side is 1024 (it normalises and pads to 1024 itself; it does not resize). Output image_embeddings [1, 256, 64, 64].

Decoder (one mask). image_embeddings; point_coords (in the resized 1024 frame) with point_labels 1 = object / 0 = background (and a -1 pad point); mask_input [1, 1, 256, 256] with has_mask_input; orig_im_size [h, w]. Output masks at the original size (logits; > 0 = object).

export/ holds Acly's export scripts (MIT): export_image_encoder.py wraps the encoder with its normalisation and padding; the decoders come from MobileSAM's own export_models.py.

Licences

  • MobileSAM weights and code: Apache License 2.0 (Chaoning Zhang et al.).
  • The ONNX export and scripts: MIT (Acly).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support