PicoSAM3
PicoSAM3 is a compact CNN distilled from SAM 2.1 and SAM 3, built for box-prompted region-of-interest segmentation on sensors like the Sony IMX500. LibreYOLO supports it through a dedicated LibreSAM factory, separate from the LibreYOLO() detector factory, with box prompts only.
- Tasks
- instance segmentation
- Sizes
- pico at 96 px
- Install
pip install libreyolo- Support tier
- Sibling tier, since v. A separate product surface with its own factory and contract.
- Licenses
- Code Apache-2.0, weights Apache-2.0. Commercial use
Install
PicoSAM3 needs the sam extra: LibreYOLO's own weight download still goes
through transformers' Hugging Face tooling, even though inference runs on a
native, non-transformers CNN.
pip install "libreyolo[sam]"Predict
LibreSAM(...) (or the family-specific LibrePicoSAM3(...)) is a separate
entry point from LibreYOLO(...): it returns a promptable segmenter rather
than a detector, because a forward pass here is meaningless without a
prompt. There is no libreyolo predict CLI command for this family; use the
Python API.
from libreyolo import LibreSAM, SAMPLE_IMAGE # PicoSAM3 has a single size, "pico", so no other alias is needed.model = LibreSAM("picosam3") # bboxes= is the only supported prompt: [x1, y1, x2, y2] or a list of# boxes, one mask per box. Each box is expanded 10%, made square,# clipped to the image and resized to 96x96 before the CNN runs.result = model.predict(SAMPLE_IMAGE, bboxes=[300, 200, 900, 700])print(result.masks.xy) # polygon per maskprint(result.boxes.xyxy) # tight box derived from the maskfrom libreyolo import LibrePicoSAM3, SAMPLE_IMAGE model = LibrePicoSAM3() # set_image() caches the source image; PicoSAM3 runs one full CNN# forward per box, so this saves the image load/decode, not an# encoder pass the way it does for the other SAM families.model.set_image(SAMPLE_IMAGE)a = model.predict(bboxes=[300, 200, 900, 700])b = model.predict(bboxes=[100, 100, 400, 400])model.reset_image()PicoSAM3 accepts only bboxes=; passing points=, labels=, masks=,
text=, multimask=True or omitting the box to segment everything all
raise a clear ValueError, since none of those modes exist in the upstream
model. conf filters by predicted mask quality (IoU), not a detection
confidence, and must be between 0.0 and 1.0. Every mask carries class id
0, named "object". train(), val() and track() raise
NotImplementedError; use LibreSAM2 or LibreSAM3 for point, text, mask or
segment-everything prompts. See prediction for source types.
Variants
One size, pico, at a fixed 96 px ROI input: PicoSAM3 runs one full CNN forward per box rather than encoding the whole image once.
Export
| Task | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Instance segmentation | Instance segmentation to ONNX: supported. | Instance segmentation to TorchScript: not supported | Instance segmentation to ExecuTorch: not supported | Instance segmentation to TensorRT: not supported | Instance segmentation to OpenVINO: not supported | Instance segmentation to Paddle: not supported | Instance segmentation to MNN: not supported | Instance segmentation to RKNN: not supported | Instance segmentation to ncnn: not supported | Instance segmentation to TFLite: not supported | Instance segmentation to CoreML: not supported | Instance segmentation to Core AI: not supported |
PicoSAM3 is the only family in the SAM tier that exports: it ships its raw
96x96 ROI CNN to ONNX, roi_image -> mask_logits, with no NMS or mask
post-processing baked in. The other SAM families raise NotImplementedError
on export(), since their encoder/decoder split has no defined runtime export
contract yet. An exported PicoSAM3 graph does not load back through
LibreYOLO(); run it directly with a runtime such as onnxruntime, applying
the same 10%-padded square-ROI preprocessing shown above.
from libreyolo import LibrePicoSAM3 model = LibrePicoSAM3()model.export(format="onnx", output_path="LibrePicoSAM3pico.onnx") # opset (default 13) and dynamic (default True, batch axis only) are# the only export arguments this family accepts.import numpy as npimport onnxruntime as ort # PicoSAM3 exports its raw 96x96 ROI CNN: roi_image -> mask_logits.# There is no LibreYOLO-side pre/postprocessing to reuse here, since# export() is not routed back through LibreYOLO() the way a detector# checkpoint is.session = ort.InferenceSession("LibrePicoSAM3pico.onnx")name = session.get_inputs()[0].nameoutputs = session.run(None, {name: np.zeros((1, 3, 96, 96), dtype=np.float32)}) for meta, array in zip(session.get_outputs(), outputs): print(meta.name, array.shape)Checkpoints
Every published weight file for this family.
| File | Input (px) | Weights license |
|---|---|---|
| Instance segmentation | ||
| LibrePicoSAM3.pt | apache-2.0 | |
Every file above exists in the LibreYOLO org today and downloads on first use.
Licensing
Check the license on the Hugging Face repository of the specific weights you download. Every checkpoint in the LibreYOLO org carries one, and they are not always the same across a family. That repository is the authoritative source; the summary below describes what applied when this page was last verified.
This is a description of the licenses involved, not legal advice. If the answer matters commercially, read the licenses yourself and take your own counsel.
- Original work
- PicoSAM3, ETH Zurich
- Upstream license
- Apache-2.0
- Upstream source
- github.com/pbonazzi/picosam3
- LibreYOLO code
- MIT
- Weights
- Apache-2.0, republished at huggingface.co/LibreYOLO
- Interpretation
- Apache-2.0 is a permissive license, so this code and these weights can be used in commercial and closed-source products. It asks you to keep the license text and attribution notices with any copy you redistribute, and it grants a patent license. LibreYOLO carries a native port of the compact ROI CNN rather than vendoring upstream files unmodified, and downloads LibrePicoSAM3pico.pt from the LibreYOLO Hugging Face org, converted with unchanged tensor values from the pinned pietrobonazzi/picosam3 revision af49e4322b6b7cf448499fee5c073d4576f59444 and tagged Apache-2.0 there. PicoSAM3 is distilled from SAM 2.1 and SAM 3 as teacher models; LibreYOLO does not vendor or redistribute either teacher's code or weights in this family.
PicoSAM3 is distilled from SAM 2.1 and SAM 3 as teacher models. LibreYOLO does not vendor or redistribute either teacher's code or weights in this family; only the compact student CNN and its converted checkpoint are shipped.
Citation
@article{picosam3_2026,
title={PicoSAM3: Real-Time In-Sensor Region-of-Interest Segmentation},
author={Pietro Bonazzi and Nicola Farronato and Stefan Zihlmann and Haotong Qin and Michele Magno},
journal={IEEE Sensors Journal},
year={2026}
}Copied from the authors' citation block at github.com/pbonazzi/picosam3#readme.