LibrePicoSAM3 / README.md
Xuban's picture
Add MobileSAM comparison
c1cd367 verified
|
Raw
History Blame Contribute Delete
3.51 kB
---
license: apache-2.0
library_name: libreyolo
pipeline_tag: image-segmentation
tags:
- libreyolo
- picosam3
- segmentation
- promptable-segmentation
- edge
- imx500
---
# LibrePicoSAM3
Edge tier of the LibreYOLO `LibreSAM` promptable-segmentation family: a
1,371,418-parameter CNN that segments the object inside a box-defined region of
interest. It is small enough to run in-sensor on the Sony IMX500 and is the
smallest promptable segmenter LibreYOLO ships, sitting below MobileSAM.
## Usage
```python
from libreyolo import LibreSAM
model = LibreSAM("picosam3")
result = model.predict("image.jpg", bboxes=[100, 100, 400, 500])
result.show()
```
`bboxes=` is the only supported prompt. Point, text, mask, multimask and
segment-everything modes are not part of the upstream model contract and raise
a clear error; use `LibreSAM("sam2")` or `LibreSAM("sam3")` for those.
## Measured quality
Evaluated by LibreYOLO on **COCO val2017**, using ground-truth boxes as ROI
prompts and ground-truth masks as reference:
| Protocol | mIoU |
|---|---|
| Crop space, 96x96 (upstream evaluation protocol) | **0.692** |
| Full image, end-to-end via `LibrePicoSAM3.predict()` | **0.697** |
Measured on 2000 randomly sampled non-crowd instances (seed 0, no area filter).
The PicoSAM3 paper reports 65.45 mIoU on COCO; our sampling and filtering may
differ from theirs, so we publish the number we measured rather than restating
theirs as reproduced.
### Against MobileSAM
Same 150 COCO instances, same box prompts, single-threaded CPU:
| Model | Params | mIoU | CPU latency |
|---|---|---|---|
| LibrePicoSAM3 | 1.37M | 0.691 | **8.6 ms/prompt** |
| LibreMobileSAM | 10.13M | **0.800** | 407 ms/prompt |
MobileSAM is the better segmenter; prefer it when a GPU is available or quality
dominates. PicoSAM3 trades ~11 mIoU points for 7x fewer parameters and ~47x
lower CPU latency, which is what makes CPU-only and in-sensor deployment viable.
## Provenance
- **Architecture**: ported from [pbonazzi/picosam3](https://github.com/pbonazzi/picosam3)
(Apache-2.0), commit `1b03949e43472953bb0021685c7fc3f5fdf48fde`. The LibreYOLO
implementation is native and produces bit-identical outputs to upstream
(max abs diff 0.0 on a seeded FP32 batch).
- **Weights**: converted from
[pietrobonazzi/picosam3](https://huggingface.co/pietrobonazzi/picosam3)
(Apache-2.0), revision `af49e4322b6b7cf448499fee5c073d4576f59444`, file
`PicoSAM3_SAM3_student_best.pt`. Re-wrapped into the LibreYOLO checkpoint
schema (v1) with provenance metadata; tensor values are unchanged.
- **Teacher chain**: upstream distilled this student from SAM 2.1 and SAM 3.
Teacher implementations and checkpoints are not included or redistributed
here. Meta's SAM License places ownership of distilled derivative works with
their creator and does not impose license inheritance, so these weights are
redistributed under the upstream author's Apache-2.0 terms.
- **Training data**: COCO 2017 and LVIS v1.
Note: the `PicoSAM3_student_epoch1.pt` and `PicoSAM3_epoch1.pt` files in the
upstream weights repo contain the older PicoSAM2 architecture (`output_head.*`)
and do not load as PicoSAM3. LibreYOLO ships the `best` artifact and rejects the
epoch-1 files explicitly.
## Citation
```bibtex
@article{picosam3_2026,
title={PicoSAM3: Real-Time In-Sensor Region-of-Interest Segmentation},
journal={IEEE Sensors Journal},
year={2026}
}
```
## License
Apache-2.0, inherited from the upstream code and weights.