feat(sam3): add SAM3-LiteText image segmentation presets#264
Open
wep21 wants to merge 1 commit into
Open
Conversation
SAM3-LiteText (arXiv:2602.12173) is SAM3-Image with the heavy text encoder replaced by a distilled MobileCLIP student; the ViT-H vision encoder, geometry encoder and mask decoder are kept intact. The presets therefore reuse the SAM3 image vision/decoder ONNX (jamjamjon/assets `sam3`) and only swap in the lightweight MobileCLIP text encoder (wep21/assets `sam3-litetext`). - Config::sam3_litetext_s0() / _s1() / _l() (MobileCLIP-S0/S1/L) - open-set-segmentation example: `sam3-litetext` subcommand (reuses the Sam3Image inference path) + README usage - scripts/sam3-litetext: text-encoder ONNX export (fp32 + fp16 via modelopt AutoCast), verified ORT==PyTorch (fp32 cos=1.0, fp16 cos~=0.99999) Quality matches SAM3-Image (dog.jpg: 0.972 vs 0.965); the text encoder is ~8x smaller (674MB -> 83MB) with equivalent end-to-end masks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds SAM3-LiteText (arXiv:2602.12173) — SAM3-Image with the heavy text encoder replaced by a distilled MobileCLIP student. The ViT-H vision encoder, geometry encoder and mask decoder are kept intact, so the presets reuse the existing SAM3 image vision/decoder ONNX (
jamjamjon/assetssam3) and only swap in the lightweight MobileCLIP text encoder (wep21/assetssam3-litetext).Config::sam3_litetext_s0()/_s1()/_l()(MobileCLIP-S0 / S1 / MobileCLIP2-L)sam3-litetextsubcommand (reuses theSam3Imageinference path) + README usagescripts/sam3-litetext/: text-encoder ONNX export (fp32 + fp16 via NVIDIA Model Optimizer AutoCast)Verification
cos=1.0, fp16cos≈0.99999) for s0/s1/lSam3LiteTextModeloutputdog.jpg -p dog:dog 0.965vs SAM3-Image0.972— equivalent masksQuality / perf vs SAM3-Image (dog.jpg)
The benefit is text-encoder memory/size (~8×) and load time; end-to-end latency is similar (ViT-H vision dominates).
🤖 Generated with Claude Code