SAM3 Shelf D2 — delivery checkpoint, step 2261
Complete sale-unit instance masks for supermarket and warehouse shelves, using
the fixed text prompt an object on the shelf. A transparent multipack is one
instance when the complete package is annotated as one GT. This is a complete
Hugging Face Sam3Model checkpoint, not a LoRA adapter or a video tracker.
固定提示词下的货架商品实例分割,目标是完整销售单元,包括透明组合包装。 本仓库提供完整HF格式权重,不含私有图片、mask标注或内部逐图日志。
- Associated code: https://github.com/sdoqb15/sam3_shelf, project
sam3_shelf_public. - Companion model: https://huggingface.co/sdoqb15/sam3-shelf-c7a-2380.
- Private data snapshot: sdoqb15/sam3-shelf-data. Access requires owner authorization.
- Selected update: 2261. This is D2 step 2261, NOT the validation BEST at step 714.
- Weight SHA256:
fef9906a67ed8fe3c93e402a7345e7318ad1b32c6081dc4828fb32feee7c5fb0.
Problem background and downstream motivation / 问题背景与下游需求
Original SAM3 can segment many shelf products. In our supermarket/warehouse scenes, however, it can split a transparent-film multipack of identical items into its contents or return only part of the complete package. Its score order does not consistently prioritize a complete, currently exposed outermost item. Merged front/back products and masks containing unrelated regions can also become high-ranking candidates, including after poorly targeted fine-tuning.
Downstream systems embed masked product crops and compare them with a SKU vector database to select a mask for robot picking. An incomplete package or a mixture of products produces an unhelpful appearance representation; poor ranking increases candidate-processing work and can displace the correct mask. The selected boundary then affects target/grasp-region estimation. A downstream selector cannot recover a full mask that was never proposed.
The goal is to recall complete individual sale units, including whole multipacks, and rank useful complete candidates ahead of fragments or merges. Each column has its own current outermost item: after front products are removed, a deeper item can become the target. Useful independent rear masks remain acceptable. Merely covering part of a front product does not make a messy merged mask a good candidate.
原始SAM3能分割许多商品,但在本项目场景中,容易把多个相同商品用透明薄膜绑在一起的 组合商品拆成内部单品,或只分割完整包装的一部分;当前最外侧完整商品的mask也不一定 优先返回。部分微调还可能把包含前后商品或无关区域的杂乱mask排得过高。
下游需要对mask区域提取向量,和SKU向量库匹配并挑选mask,再用于机器人抓取。 残缺或混合的mask会干扰商品向量表征和匹配,增加候选处理开销,并影响抓取目标与区域 估计。因此目标是让完整销售单元的候选能被召回并合理靠前,而不是单纯增加mask数量。 各列排数不同,拿走前排后露出的靠里商品也属于当前目标;有用的后排分割能力应保留。
These are intended segmentation/ranking objectives, not a guarantee that every candidate is correct. Segmentation scores do not directly predict physical reachability or grasp success, and no robot grasp-success improvement is claimed from the segmentation metrics alone.
完整任务定义与下游影响 / Full task definition: https://github.com/sdoqb15/sam3_shelf/blob/main/docs/problem_statement.md.
Operating point / 推理口径
| Setting | Value |
|---|---|
| Prompt | an object on the shelf |
| Score | strictly > 0.1, compared in FP32 |
| Mask threshold | 0.5 |
| Near-duplicate mask NMS | IoU > 0.98 |
| Candidate cap | None |
| Output | Native-resolution masks and scores |
operating_point.json records these settings; plain Transformers does not
automatically apply that file. Reported metrics use empty-mask removal and mask
NMS. Use the associated project's inference path to reproduce this operating point.
Training / 训练
Both released models start from original SAM3, independently. D2 uses the same joint method as C7-A with an expanded data pool; D2 is not initialized from C7-A.
- Trainable: DETR encoder, DETR decoder, mask decoder and scoring/presence modules; 24,529,462 parameters. Vision/text and other modules remain frozen. No LoRA.
- Human GT takes priority. GT-matched queries receive detection/segmentation supervision. Other unmatched queries are focal-background negatives except the following GT-safe teacher cases.
- Original-SAM3 teacher score >=0.90 AND GT-safe: soft mask/box/score preservation, weight 0.25; excluded from background negatives.
- Teacher score 0.85–0.90 AND GT-safe: unknown, no teacher distillation or background negative. GT-conflicting candidates cannot obtain either protection; human positives still take priority.
- GT safety requires intersection / teacher area <=0.02 and intersection / each GT area <=0.02. Teacher geometric association uses IoU >=0.5; at most32 teacher candidates receive supervision, with safe overflow retained as unknown.
- AdamW, LR1e-5, cosine schedule2380 updates, 5% warmup, tail LR1e-6, weight decay1e-4, gradient clip1.0, effective batch4, seed42, no augmentation.
- Per-image sampling weight: multi-product8, single-product1.
| Pool | Images | GT | Role |
|---|---|---|---|
| Training | 1824 | 4156 | 600 multi-product + 1224 single-product images |
| Validation | 72 | 362 | Never trained; used for checkpoint selection |
| Regression | 162 | 808 | Included in training |
| Supplemental annotated | 35 | 107 | Included in training after deduplication |
M1/M2/M3 are internal retail/warehouse collections. Single-product images use one image per SKU in this pool. Annotations are partial: they primarily cover the outermost visible sale units, not every rear-row product. The supplemental data include shelves with front products removed. All raw data remain private.
D2将原测试集和前程35张标注加入训练;162张指标是训练回看,不是独立测试。2261步是人工视觉偏好选择,验证集选出的BEST是714步,两个权重不可混称。
Resource accounting / 训练资源
One NVIDIA A80080GB. The joint session ran 2261 updates in 58.42 minutes, including validation and continuation; the released artifact is update2261. Peak PyTorch training memory: 9.10GiB allocated / 22.48GiB reserved. These session costs are not a separately measured time-to-selected-checkpoint.
Evaluation / 评测
The 162-image regression set and 35 annotated supplemental images were included in D2 training. Their scores are training-fit results, NOT independent test results.
A GT is complete when prediction coverage >=0.95 AND purity >=0.95, with maximum-cardinality one-to-one matching. TOP-N uses actual score order after threshold/NMS. Extra unannotated rear objects are not penalized as false positives. These are task-specific completeness metrics, not COCO AP or mean IoU.
| Scope | Complete GT | TOP-5 complete GT | TOP-10 complete GT | Successful images | Mean candidates |
|---|---|---|---|---|---|
| Validation, model-selection set | 356/362 | 352/362 | 356/362 | 66/72 | 6.92 |
| Training-fit regression | 788/808 | 776/808 | 787/808 | 143/162 | 6.75 |
See training_summary.json for structured training, metrics, resource and timing
records. No accuracy numbers are invented for the unannotated supplemental images.
Scores are not calibrated probabilities of a correct complete mask. Merged,
truncated or redundant candidates remain possible; inspect masks and downstream matching.
Use with Transformers
Tested: Python3.12, PyTorch2.5.1+cu121, Transformers5.12.1. This checkpoint uses
the Transformers SAM3 API; the native upstream .pt loader is a different format.
import torch
from PIL import Image
from transformers import Sam3Model, Sam3Processor
repo = "sdoqb15/sam3-shelf-d2-2261"
model = Sam3Model.from_pretrained(repo, dtype=torch.bfloat16).to("cuda").eval()
processor = Sam3Processor.from_pretrained(repo)
image = Image.open("your_image.png").convert("RGB")
inputs = processor(images=image, text="an object on the shelf", return_tensors="pt").to("cuda")
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
output = model(**inputs)
raw = processor.post_process_instance_segmentation(
output, threshold=0.09, mask_threshold=0.5,
target_sizes=[(image.height, image.width)],
)[0]
keep = raw["scores"].float() > 0.1
masks = raw["masks"][keep]
scores = raw["scores"][keep].float()
# This minimal snippet has not removed empty/near-duplicate masks.
# For the reported operating point, use sam3-shelf's empty-mask removal and IoU0.98 mask NMS.
The associated repository's scripts/download_models.py downloads a pinned
revision, checks the weight SHA256, and feeds the local sam3-shelf infer entrypoint.
The code repository is maintained separately; no private source history is included here.
License and attribution
Derived from Meta SAM3. The upstream SAM License accompanies these weights. This does not select a new license for the associated project's code or grant access to the private dataset. SAM3 citation: SAM3: Segment Anything with Concepts.