sharp-ax8860 / README.md
zheqiushui's picture
SHARP on AX8860: models, binaries, Python binding, web demo
31e2a6c verified
|
Raw History Blame Contribute Delete
3.93 kB
---
license: other
license_name: apple-amlr
license_link: https://huggingface.co/AXERA-TECH/sharp-ax8860/blob/main/LICENSE_MODEL
pipeline_tag: image-to-3d
tags:
- gaussian-splatting
- 3dgs
- novel-view-synthesis
- axera
- ax8860
- npu
---
# SHARP on AX8860
Single image β†’ 3D Gaussian Splatting **on the AX8860 NPU in ~1.6 s**: Apple's [SHARP](https://github.com/apple/ml-sharp) model converted for the AXERA AX8860.
单张照片 β†’ 3D ι«˜ζ–―οΌˆ3DGSοΌ‰οΌŒ**AX8860 η«―δΎ§ηΊ¦ 1.6 η§’**。
Code (C++ / C API / Python / web demo): **[github.com/AXERA-TECH/sharp-ax8860](https://github.com/AXERA-TECH/sharp-ax8860)**
<p align="center"><img src="assets/ant.webp" width="808" alt="left: input photo, right: 3D Gaussians generated on AX8860, rendered from moving viewpoints"></p>
<p align="center"><sub>Left: input photo Β· Right: 3D Gaussians generated on the AX8860 board, rendered from new viewpoints</sub></p>
## Performance
| Stage | Time (ms) | Where |
|---|---:|---|
| JPEG decode (hardware JDEC) | 20–60 | VDEC |
| Pre-process | ~70 | CPU |
| ViT Γ—36 (DINOv2-L, FP8) | ~760 | NPU |
| Tail (DPT + Gaussian decoder, U16) | ~490 | NPU |
| Depth head last layer (FP32) | ~50 | CPU |
| Post-process | ~160 | CPU |
| Write SPZ / PLY | ~170 / ~65 | CPU |
| **End-to-end** | **~1600–1700** | |
AX8860, 4 NPU cores, SDK V0.6.0. Model loading (once): ~0.8 s. Output: 1,179,648 Gaussians, SPZ 12–17 MB or PLY 66 MB.
Quality vs. the official FP32 model on GPU (renderings from 4 shifted viewpoints, photos not used for calibration): median PSNR **41.9 dB** on 29 COCO photos, **33.9 dB** on 50 DIV2K photos.
## Files
```
models/
β”œβ”€β”€ fp8vit/ # DINOv2-L ViT (patch + image encoder): FP8 kernels + weight banks
β”œβ”€β”€ sharp_tail.axmodel # DPT decoder + Gaussian decoder, U16
└── h4_wb.bin # last 1x1 conv of the depth head (fp32, run on the CPU)
bin/
β”œβ”€β”€ sharp_ax # command line tool (aarch64, glibc >= 2.38)
└── libsharp_ax.so # C API for Python / other languages
python/
β”œβ”€β”€ sharp_ax.py # ctypes binding
β”œβ”€β”€ web_demo.py # browser demo served from the board
└── web_demo.html
```
## Usage
```bash
# command line: .spz = SPZ v2, .ply = same PLY layout as ml-sharp
LD_LIBRARY_PATH=/opt/lib ./bin/sharp_ax -m models -i photo.jpg -o photo.spz
# Python (standard library only)
cp bin/libsharp_ax.so python/ && cd python
python3 -c "from sharp_ax import Sharp; print(Sharp('../models').run('photo.jpg', 'photo.spz'))"
# web demo: open http://<board-ip>:8080, upload a photo, view the result in the browser
python3 web_demo.py -m ../models --port 8080
```
The `.spz` result can also be opened in viewers such as [SuperSplat](https://superspl.at/editor).
## Model derivative and license
*Apple Machine Learning Research Model is licensed under the Apple Machine Learning Research Model License Agreement.*
These files are **model derivatives** of Apple's SHARP checkpoint, released under the [Apple Machine Learning Research Model License](LICENSE_MODEL) β€” **for non-commercial research purposes only**. This project is not affiliated with or endorsed by Apple.
Changes made to the original model:
- Split into a ViT part (DINOv2-L patch and image encoders, run 35 + 1 times per image) and a decoder part (DPT + Gaussian decoder).
- ViT weights and activations quantized to FP8 and run with custom NPU kernels.
- Decoder compiled with pulsar2 using U16 activations (INT8 weights), calibrated on 80 photos; 16-bit tensors above 128 MiB split along channels; the image is fed as a 2Γ—2 space-to-depth tensor.
- The last 1Γ—1 convolution of the depth head is taken out of the NPU graph and computed on the CPU in FP32.
- Pre- and post-processing re-implemented in C++; optional SPZ output (quantized positions/attributes).
Demo photo: [Pexels](https://www.pexels.com) (Niko Desmon).