Skip to main content
Back

ETH Zürich's PicoSAM3 Beats SAM-H While Running on a Camera Sensor

A 1.3M parameter segmentation model runs entirely inside a Sony camera sensor at 84 FPS, beating SAM-H accuracy at 1/460th the size.

Pro

  • PicoSAM3 runs promptable segmentation entirely inside the Sony IMX500 sensor in 11.82 ms (84 FPS).
  • At 1.37M parameters and 1.31 MB INT8, it scores 65.45% mIoU on COCO and 64.01% on LVIS.
  • Beats SAM-H by 11.85 mIoU on COCO while being 460x smaller at the sensor's native 96x96 resolution.
  • Uses a CNN-only U-Net because IMX500 lacks Softmax, LayerNorm, and GELU integer kernels.
  • Prompts are encoded implicitly as centered crops via the sensor's hardware ROI API, no prompt encoder needed.
  • Code and deployment scripts are open source at github.com/pbonazzi/picosam3.

Running Segment Anything on a camera sensor sounds absurd. SAM-H weighs 2.4 GB and needs a datacenter GPU to move at any reasonable speed. Yet a team from ETH Zürich and IBM Research just squeezed promptable segmentation into 1.31 MB of INT8 weights that execute directly on Sony's IMX500 vision sensor in under 12 milliseconds, and somehow the tiny model scores higher on COCO than the original SAM.

The model is called PicoSAM3, and the code is available on GitHub. It targets a specific and increasingly important niche: in-sensor computing, where the neural network runs on silicon fused with the image sensor itself rather than on a phone SoC or a Raspberry Pi.

Why the sensor, not the CPU

The Sony IMX500 is a stacked CMOS image sensor with a small AI accelerator baked directly underneath the pixel array. It integrates a CMOS image sensor vertically stacked with a dedicated edge AI processor, which means inference happens before the raw frame ever leaves the chip. No PCIe, no MIPI bus contention, no privacy concerns from shipping pixels to the cloud.

The catch is brutal. The IMX500 operates within a strictly bounded on-chip SRAM of less than 8 MB and supports a limited set of quantization-friendly operators. That rules out most modern segmentation stacks. Existing promptable segmentation models such as TinySAM, EdgeSAM, MobileSAMv2, and LiteSAM either exceed memory budgets, rely on unsupported operators like complex non-linear activations, or depend on the large-scale memory access patterns of transformer-based architectures.

Concretely, Sony's compilation toolchain does not include integer implementations of Softmax (required by self-attention), LayerNorm (required in every transformer sublayer), or GELU (used in transformer FFNs). Any model containing these operations fails MCT compilation entirely and cannot be deployed on the sensor. The authors even tried a hybrid MobileViT baseline. It failed to compile.

Raspberry Pi 5 connected to Sony IMX500 AI camera module

The trick: prompts as crops

Classic SAM takes an image plus a prompt (a point, a box, a rough mask) and produces a segmentation. But the IMX500 only accepts RGB pixels as input. There's no side channel for prompt coordinates.

The team's workaround is elegant. Instead of encoding the prompt as an extra tensor, they encode it as the crop itself. At training time, the ground-truth bounding box is padded by 10%, squared off, and resized to 96x96. The network learns to segment the dominant object near the image center, effectively treating the crop center as an implicit point prompt and the crop boundaries as an implicit box prompt.

At inference this maps perfectly onto the IMX500's hardware ROI (region of interest) API. The user drags a rectangle on a display, the coordinates get pushed to the sensor via set_inference_roi_abs(), and the sensor crops, resizes, and infers in hardware. No prompt encoder needed.

Architecture: aggressively boring, on purpose

Under the hood PicoSAM3 is a U-Net with depthwise separable convolutions, four encoder stages going from 48 to 256 channels, a bottleneck, and a mirrored decoder with skip connections. The interesting additions are minimal:

  • A dilated depthwise convolution in the bottleneck to widen the receptive field without another downsample.
  • An Efficient Channel Attention block before the output head, which is essentially a cheap 1D conv over channel statistics instead of a full attention matrix.
  • A refinement head with a depthwise convolution for cleaner boundaries.

These additions increase the model to 1.37M parameters (5.26 MB), or 1.31 MB quantized, an 8.6% overhead for improved segmentation quality. The design is deliberately transformer-free because, as the paper argues, the purely convolutional design is not a compromise but the optimal choice for this hardware class.

Distillation from SAM3 does the heavy lifting

The performance jump comes from a two-stage distillation pipeline. For each annotation, SAM3 receives the corresponding bounding box as a geometric prompt and generates a soft probability mask. Those soft masks are cached offline so the 1.2 GB teacher never needs to run during training.

The loss mixes three terms: a teacher-matching MSE plus Dice on temperature-scaled logits, a hard-label BCE plus Dice against the ground truth, and an area preservation term that fires when the predicted mask collapses below 40% of the ground truth area. The teacher and ground-truth losses are blended based on the teacher's own confidence, so noisy SAM3 predictions get down-weighted automatically.

The ablations make the case clearly: ROI cropping alone lifts mAP from 29.96% to 40.52%, and swapping the SAM2 teacher for SAM3 adds another point. Together they deliver a +10.1% mIoU gain.

Numbers

Here is where things get uncomfortable for the incumbents.

ModelParamsSizeCOCO mIoULVIS mIoU
SAM-H635M2420 MB53.6%60.5%
FastSAM72.2M275.6 MB51.6%55.2%
TinySAM9.7M37.0 MB50.9%52.1%
EdgeSAM9.7M37.0 MB48.0%53.7%
Q-PicoSAM31.37M1.30 MB65.34%63.98%

PicoSAM3 beats SAM-H by +11.85 mIoU on COCO (65.45% vs. 53.6%) and +3.5 mIoU on LVIS while being 460x smaller. The catch is that this evaluation is done at 96x96 resolution inside the crop, so the large models are being penalized for their high-resolution bias. Still, at the deployment resolution the sensor actually supports, the tiny model wins.

On the IMX500 itself, the quantized model runs one segmentation in 11.82 ms, roughly 84 FPS. Energy comes out to around 139 microjoules per inference, which the authors note is two to three orders of magnitude below a GPU inference and is consistent with battery-operated IoT operation.

Segmentation comparison between SAM2.1 L, SAM3, PicoSAM2, and PicoSAM3

Where it breaks

PicoSAM3 has predictable weak spots that are worth knowing before you deploy it. The paper identifies four failure modes:

  1. Transparent or textureless surfaces like glass, water, and mirrors, where foreground and background share texture statistics.
  2. Severely occluded objects where less than roughly 30% of the target is visible in the crop.
  3. Sub-resolution small objects under 10x10 pixels at 96x96, where the model over-segments toward the full crop.
  4. Amorphous objects like clouds, smoke, or liquid pours with no clear boundary.

Dense scenes also hurt. Dense crops (3 + competing objects) drop mIoU performance by ≈ 14 points relative to unambiguous crops. If your bounding box contains multiple similar objects, the model's implicit assumption that the centered object is the target starts to break down.

Why this matters

The interesting story here is not really the mIoU number. It is that the constraints of in-sensor silicon force a very specific kind of design: no attention, no LayerNorm, no fancy prompt encoders, everything INT8, everything under 2 MB of SRAM. Within those bounds, aggressive knowledge distillation from a state-of-the-art teacher plus a clever prompt-as-crop trick is enough to match or beat models 100x to 1000x larger.

For anyone building smart glasses, battery-powered cameras, wildlife monitors, or privacy-first IoT vision, this is a concrete demonstration that promptable segmentation can live entirely on the sensor die. No cloud round trip, no host CPU wake-up, and a power budget measured in milliwatts.