CoolFace
Modelpublic

latolukasz/sam2.1-hq-hiera-large-onnx

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
0likes
Model Card

HQ-SAM 2 (sam2.1hqhiera_large) — ONNX decoder

Server-side export of SysCV's HQ-SAM 2 (sam2.1_hq_hiera_large checkpoint, 224.7M params): SAM 2.1 Hiera Large with an extra learnable high-quality output token and global-local feature fusion, trained on HQSeg-44K for fine structures (thin edges, insect legs/wings).

Files

FileSizeNotes
decoder_hq.onnx17 MBHQ prompt decoder (points/box → masks). Output masks are the three SAM multimask candidates with the HQ residual mask added (masks_hq + masks_sam, MaskDecoderHQ.forward multimask path).

No encoder here on purpose: HQ-SAM 2's image encoder is the frozen SAM 2.1 Hiera Large encoder — its ONNX outputs are bit-identical (verified max abs diff 0.0) to latolukasz/sam2.1-hiera-large-onnx encoder.onnx. Use that encoder with this decoder.

Provenance

  • —Checkpoint: lkeab/hq-sam sam2.1_hq_hiera_large.pt (SysCV, 2024-11-17, Apache 2.0)
  • —Code: SysCV/sam-hq sam-hq2, config sam2.1_hq_hiera_l.yaml
  • —Export: adapted samexporter export_sam2.py decoder wrapper, replicating MaskDecoderHQ.forward's multimask path (5 candidate masks [single, m1, m2, m3, hq]; output = masks[4:5] + masks[1:4], iou = iou_pred[1:]). torch 2.13, opset 18.

Interface

Decoder: image_embed [1,256,64,64], high_res_feats_0 [1,32,256,256], high_res_feats_1 [1,64,128,128], point_coords [n,p,2], point_labels [n,p] float32, mask_input [n,1,256,256], has_mask_input [n] → masks [n,3,256,256] logits (clamped ±32), iou_predictions [n,3].

Same interface as the base-plus and large decoders — drop-in swap.