BiRefNet-lite实现1024像素手机端分割
独立研究者/u/subhashg547称,其重写的BiRefNet-lite可在Snapdragon 8 Elite Gen 5的NPU上完全生成1024×1024掩膜,在Galaxy S26上耗时23.7毫秒。该全8位版本改用普通卷积并调整移窗注意力,通过量化感知蒸馏训练;其在ECSSD和DUT-OMRON上的S-measure分别为0.939和0.830。研究人员还公开了开放权重、代码、技术说明及面向42款骁龙芯片的编译文件,同时指出边缘偏软、在DIS-VD细结构上损失0.017,以及不支持MediaTek和Tensor。
该项目以公开的权重、代码和测试结果展示了在骁龙NPU上实现高分辨率端侧分割的一种具体方案。
I wanted tap-to-lift subject cutout in my Android gallery app, running fully on the NPU. BiRefNet-lite gave the best masks of the open models I tried, but it doesn't compile to a phone NPU. The decoder has 20 deformable convs, Swin uses 5D/6D tensors, the shifted windows use a cyclic roll, and 1024px activations don't fit in on-chip memory. So I rewrote it.
What I did:
- Exact graph rewrites (same output as the original): 4D window partition, roll-free shifted windows with a fixed mask, channel-split convs, attention one head at a time.
- Architecture changes: plain convs instead of deformable, 640px backbone with a 1024px mask from two inputs, a slim full-res tail, one global window in Swin stage 4.
- QAT distillation through the exported NPU graph, all 8-bit.
Results:
- 23.7 ms for a 1024×1024 mask on a Galaxy S26 (8 Elite Gen 5), 31.1 ms on an S25, 182 ms on a mid-range 7 Gen 1. All 2,060 layers on the NPU.
- Stock BiRefNet-lite on the same phones: out of memory at 1024. At 512 it falls back to CPU, 677 ms and 2.1 GB peak.
- Compiles AOT for 42 Snapdragon chips as one NPU partition (one GitHub Actions job per chip).
- On held-out ECSSD and DUT-OMRON (neither model trained on them), the int8 model matches its fp32 teacher in S-measure (0.939 vs 0.938, 0.830 vs 0.826). Edges are a bit softer.
#BiRefNet-lite#Lumen Cutout#Snapdragon 8 Elite Gen 5#Galaxy S26#Galaxy S25#Snapdragon 7 Gen 1