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 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
pipeline_tag: image-to-image
|
| 6 |
+
tags:
|
| 7 |
+
- super-resolution
|
| 8 |
+
- image-upscaling
|
| 9 |
+
- image-restoration
|
| 10 |
+
- qnn
|
| 11 |
+
- onnx
|
| 12 |
+
- snapdragon
|
| 13 |
+
- qualcomm
|
| 14 |
+
- mobile
|
| 15 |
+
- npu
|
| 16 |
+
- android
|
| 17 |
+
- generative-ai
|
| 18 |
+
library_name: custom
|
| 19 |
---
|
| 20 |
+
|
| 21 |
+
# PiSA-Lite
|
| 22 |
+
|
| 23 |
+
**PiSA-Lite is a lightweight, mobile-optimized version of PiSA-SR for Snapdragon-powered smartphones. It is designed to preserve high-quality textures and semantic image details while running through Qualcomm's NPU.**
|
| 24 |
+
|
| 25 |
+
> PiSA-Lite is an unofficial optimization based on PiSA-SR. It is not affiliated with or endorsed by the original PiSA-SR authors.
|
| 26 |
+
|
| 27 |
+
## Overview
|
| 28 |
+
|
| 29 |
+
PiSA-Lite keeps the original PiSA-SR architecture and its semantic image-restoration behavior while preparing the model for mobile deployment.
|
| 30 |
+
|
| 31 |
+
Unlike small super-resolution models that mainly sharpen edges, PiSA-Lite aims to preserve PiSA-SR's ability to reconstruct material-aware details such as:
|
| 32 |
+
|
| 33 |
+
- wood grain
|
| 34 |
+
- grass and vegetation
|
| 35 |
+
- metal reflections
|
| 36 |
+
- fabric textures
|
| 37 |
+
- hair and fine surface details
|
| 38 |
+
- building and object structure
|
| 39 |
+
|
| 40 |
+
The current release includes:
|
| 41 |
+
|
| 42 |
+
- precompiled Qualcomm QNN Context Binaries for Snapdragon 8 Gen 3
|
| 43 |
+
- ONNX source models for compiling separate builds for other supported Snapdragon chips
|
| 44 |
+
- a fixed 4Γ super-resolution pipeline
|
| 45 |
+
- an FP16/W8A16 quality configuration
|
| 46 |
+
|
| 47 |
+
## Model Details
|
| 48 |
+
|
| 49 |
+
| Property | Value |
|
| 50 |
+
|---|---|
|
| 51 |
+
| Base project | PiSA-SR |
|
| 52 |
+
| Task | Generative image super-resolution |
|
| 53 |
+
| Input | 128 Γ 128 RGB image |
|
| 54 |
+
| Output | 512 Γ 512 RGB image |
|
| 55 |
+
| Upscale factor | 4Γ |
|
| 56 |
+
| Latent shape | `1 Γ 4 Γ 64 Γ 64` |
|
| 57 |
+
| Target runtime | Qualcomm QNN / HTP NPU |
|
| 58 |
+
| Current target SoC | Snapdragon 8 Gen 3 / SM8650 |
|
| 59 |
+
| Current target device family | Samsung Galaxy S24 Family |
|
| 60 |
+
| Deployment format | QNN Context Binary |
|
| 61 |
+
| Source export format | ONNX |
|
| 62 |
+
|
| 63 |
+
## Files
|
| 64 |
+
|
| 65 |
+
### Snapdragon 8 Gen 3 QNN Models
|
| 66 |
+
|
| 67 |
+
The included QNN binaries were compiled specifically for Snapdragon 8 Gen 3 / SM8650:
|
| 68 |
+
|
| 69 |
+
```text
|
| 70 |
+
pisa_encoder_quality.bin
|
| 71 |
+
pisa_denoiser_quality.bin
|
| 72 |
+
pisa_decoder_quality.bin
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
| File | Purpose | Precision | Approximate size |
|
| 76 |
+
|---|---|---:|---:|
|
| 77 |
+
| `pisa_encoder_quality.bin` | Converts the image into latent space | FP16 | 74 MiB |
|
| 78 |
+
| `pisa_denoiser_quality.bin` | Restores PiSA textures and semantic details | W8A16 | 791 MiB |
|
| 79 |
+
| `pisa_decoder_quality.bin` | Converts the restored latent into an image | FP16 | 104 MiB |
|
| 80 |
+
|
| 81 |
+
Total package size is approximately **970 MiB**.
|
| 82 |
+
|
| 83 |
+
### ONNX Models
|
| 84 |
+
|
| 85 |
+
The ONNX files are source models for creating separate QNN builds for other supported Snapdragon chips:
|
| 86 |
+
|
| 87 |
+
```text
|
| 88 |
+
encoder.onnx
|
| 89 |
+
denoiser.onnx
|
| 90 |
+
decoder.onnx
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
The ONNX files are **not** pre-optimized universal mobile models. They must be compiled for the intended Snapdragon target using Qualcomm AI Hub, QAIRT, or another compatible Qualcomm QNN toolchain.
|
| 94 |
+
|
| 95 |
+
## Hardware Compatibility
|
| 96 |
+
|
| 97 |
+
The supplied `.bin` files are compiled for:
|
| 98 |
+
|
| 99 |
+
```text
|
| 100 |
+
Qualcomm Snapdragon 8 Gen 3
|
| 101 |
+
SoC: SM8650
|
| 102 |
+
Samsung Galaxy S24 Family
|
| 103 |
+
Android 14
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
QNN Context Binaries are hardware-specific.
|
| 107 |
+
|
| 108 |
+
Do not assume that the supplied Snapdragon 8 Gen 3 binaries will work on:
|
| 109 |
+
|
| 110 |
+
- Snapdragon 8 Gen 2
|
| 111 |
+
- Snapdragon 8 Elite
|
| 112 |
+
- Snapdragon 7-series devices
|
| 113 |
+
- Exynos devices
|
| 114 |
+
- MediaTek devices
|
| 115 |
+
- desktop CPUs or GPUs
|
| 116 |
+
|
| 117 |
+
For another supported Snapdragon chip, use the ONNX models to compile a separate QNN package for that target.
|
| 118 |
+
|
| 119 |
+
## Pipeline
|
| 120 |
+
|
| 121 |
+
```text
|
| 122 |
+
128 Γ 128 input image
|
| 123 |
+
β
|
| 124 |
+
Resize to 512 Γ 512
|
| 125 |
+
β
|
| 126 |
+
PiSA VAE Encoder
|
| 127 |
+
β
|
| 128 |
+
Latent sampling
|
| 129 |
+
β
|
| 130 |
+
PiSA Denoiser
|
| 131 |
+
β
|
| 132 |
+
PiSA VAE Decoder
|
| 133 |
+
β
|
| 134 |
+
Color correction
|
| 135 |
+
β
|
| 136 |
+
512 Γ 512 output image
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
All three model components must be executed in order.
|
| 140 |
+
|
| 141 |
+
## Precision Configuration
|
| 142 |
+
|
| 143 |
+
The current quality release uses:
|
| 144 |
+
|
| 145 |
+
```text
|
| 146 |
+
Encoder: FP16
|
| 147 |
+
Denoiser: W8A16
|
| 148 |
+
Decoder: FP16
|
| 149 |
+
```
|
| 150 |
+
|
| 151 |
+
This reduces the size of the largest PiSA component while keeping the texture-sensitive VAE encoder and decoder in FP16.
|
| 152 |
+
|
| 153 |
+
## Android Integration
|
| 154 |
+
|
| 155 |
+
The QNN files are not standalone applications and cannot be opened directly.
|
| 156 |
+
|
| 157 |
+
An Android application must load them through Qualcomm QAIRT/QNN, typically through a native C++ layer:
|
| 158 |
+
|
| 159 |
+
```text
|
| 160 |
+
Kotlin / Java UI
|
| 161 |
+
β
|
| 162 |
+
JNI
|
| 163 |
+
β
|
| 164 |
+
C++ QNN runner
|
| 165 |
+
β
|
| 166 |
+
QNN HTP backend
|
| 167 |
+
β
|
| 168 |
+
Encoder β Denoiser β Decoder
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
Recommended private storage layout:
|
| 172 |
+
|
| 173 |
+
```text
|
| 174 |
+
/data/user/0/<application-id>/files/models/pisa_sm8650/
|
| 175 |
+
βββ pisa_encoder_quality.bin
|
| 176 |
+
βββ pisa_denoiser_quality.bin
|
| 177 |
+
βββ pisa_decoder_quality.bin
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
Because the complete model package is large, downloading the files after installation is generally preferable to embedding them directly inside the APK.
|
| 181 |
+
|
| 182 |
+
## Compiling for Another Snapdragon Chip
|
| 183 |
+
|
| 184 |
+
Use the ONNX models as source graphs and compile each component for the selected target device:
|
| 185 |
+
|
| 186 |
+
```text
|
| 187 |
+
encoder.onnx
|
| 188 |
+
denoiser.onnx
|
| 189 |
+
decoder.onnx
|
| 190 |
+
β
|
| 191 |
+
Qualcomm AI Hub / QAIRT / QNN compiler
|
| 192 |
+
β
|
| 193 |
+
target-specific QNN Context Binaries
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
A separate set of binaries should be generated for each supported Snapdragon family.
|
| 197 |
+
|
| 198 |
+
The application should detect the device SoC before downloading or loading a model package.
|
| 199 |
+
|
| 200 |
+
```text
|
| 201 |
+
SM8650 / Snapdragon 8 Gen 3
|
| 202 |
+
β Load the included SM8650 package
|
| 203 |
+
|
| 204 |
+
Another supported Snapdragon chip
|
| 205 |
+
β Download a separately compiled package
|
| 206 |
+
|
| 207 |
+
Unsupported hardware
|
| 208 |
+
β Use a smaller GPU or CPU fallback model
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
## Intended Use
|
| 212 |
+
|
| 213 |
+
PiSA-Lite is intended for:
|
| 214 |
+
|
| 215 |
+
- low-resolution photo restoration
|
| 216 |
+
- experimental mobile photography
|
| 217 |
+
- restoring vegetation and environmental details
|
| 218 |
+
- improving material textures
|
| 219 |
+
- enhancing compressed images
|
| 220 |
+
- improving game screenshots
|
| 221 |
+
- research into mobile generative super-resolution
|
| 222 |
+
|
| 223 |
+
## Out-of-Scope Use
|
| 224 |
+
|
| 225 |
+
PiSA-Lite is not recommended for:
|
| 226 |
+
|
| 227 |
+
- forensic image analysis
|
| 228 |
+
- identity verification
|
| 229 |
+
- medical imaging
|
| 230 |
+
- document or evidence recovery
|
| 231 |
+
- exact text reconstruction
|
| 232 |
+
- license-plate recovery
|
| 233 |
+
- recovering factual details that are not visible in the source image
|
| 234 |
+
|
| 235 |
+
## Limitations
|
| 236 |
+
|
| 237 |
+
PiSA-Lite is a generative super-resolution model and may create visually plausible details that were not present in the original low-resolution input.
|
| 238 |
+
|
| 239 |
+
Possible failure cases include:
|
| 240 |
+
|
| 241 |
+
- invented textures
|
| 242 |
+
- incorrect small text
|
| 243 |
+
- altered faces
|
| 244 |
+
- changed logos or symbols
|
| 245 |
+
- inaccurate fine patterns
|
| 246 |
+
- unstable results on heavily degraded inputs
|
| 247 |
+
- high memory use compared with small CNN upscalers
|
| 248 |
+
- slower inference than models such as SPAN
|
| 249 |
+
- hardware-specific deployment requirements
|
| 250 |
+
|
| 251 |
+
Generated output should not be treated as factual evidence.
|
| 252 |
+
|
| 253 |
+
## Current Status
|
| 254 |
+
|
| 255 |
+
- [x] PiSA-SR quality preserved in local testing
|
| 256 |
+
- [x] Weight-optimized PiSA-Lite package created
|
| 257 |
+
- [x] ONNX models exported
|
| 258 |
+
- [x] QNN Context Binaries compiled
|
| 259 |
+
- [x] Snapdragon 8 Gen 3 NPU inference completed
|
| 260 |
+
- [ ] Public Android runtime example
|
| 261 |
+
- [ ] On-device speed and memory benchmarks
|
| 262 |
+
- [ ] Additional Snapdragon targets
|
| 263 |
+
- [ ] Larger calibration dataset
|
| 264 |
+
- [ ] Hugging Face demo Space
|
| 265 |
+
|
| 266 |
+
## Comparison
|
| 267 |
+
|
| 268 |
+
| Model | Sharpness | Semantic texture reconstruction | Mobile suitability |
|
| 269 |
+
|---|---:|---:|---:|
|
| 270 |
+
| SPAN | Good | Limited | High |
|
| 271 |
+
| TinySR | Very good | Medium | Medium |
|
| 272 |
+
| PiSA-SR | Very good | Very high | Low |
|
| 273 |
+
| PiSA-Lite | Very good | Very high in current tests | Targeted at Snapdragon NPU |
|
| 274 |
+
|
| 275 |
+
The PiSA-Lite quality claim is based on local visual testing and should be validated on a larger public benchmark set.
|
| 276 |
+
|
| 277 |
+
## Credits
|
| 278 |
+
|
| 279 |
+
PiSA-Lite is based on the original **PiSA-SR** project and research.
|
| 280 |
+
|
| 281 |
+
All credit for the original architecture, training method, pretrained model, and research belongs to the original PiSA-SR authors.
|
| 282 |
+
|
| 283 |
+
PiSA-Lite focuses on:
|
| 284 |
+
|
| 285 |
+
- mobile deployment
|
| 286 |
+
- weight optimization
|
| 287 |
+
- fixed-shape inference
|
| 288 |
+
- ONNX export
|
| 289 |
+
- Qualcomm QNN compilation
|
| 290 |
+
- Snapdragon NPU execution
|
| 291 |
+
|
| 292 |
+
## License and Redistribution
|
| 293 |
+
|
| 294 |
+
The metadata uses `license: other` because redistribution rights may depend on multiple upstream components.
|
| 295 |
+
|
| 296 |
+
Before redistributing model weights or binaries, review and comply with:
|
| 297 |
+
|
| 298 |
+
- the original PiSA-SR license
|
| 299 |
+
- the Stable Diffusion 2.1 base-model license
|
| 300 |
+
- all pretrained-model licenses
|
| 301 |
+
- Qualcomm AI Hub and QNN terms
|
| 302 |
+
- any checkpoint or dataset restrictions
|
| 303 |
+
|
| 304 |
+
Uploading this repository does not automatically grant rights beyond the relevant upstream licenses.
|
| 305 |
+
|
| 306 |
+
## Disclaimer
|
| 307 |
+
|
| 308 |
+
This project is experimental and provided without warranty.
|
| 309 |
+
|
| 310 |
+
The maintainers are not responsible for:
|
| 311 |
+
|
| 312 |
+
- hallucinated or inaccurate reconstructed details
|
| 313 |
+
- unsupported-device crashes
|
| 314 |
+
- excessive memory usage
|
| 315 |
+
- incorrect Android integration
|
| 316 |
+
- redistribution outside upstream license terms
|
| 317 |
+
- damage or data loss caused by use of the model
|
| 318 |
+
|
| 319 |
+
Use PiSA-Lite at your own risk.
|
| 320 |
+
|
| 321 |
+
## Repository
|
| 322 |
+
|
| 323 |
+
GitHub:
|
| 324 |
+
|
| 325 |
+
```text
|
| 326 |
+
https://github.com/LoewolfERSTELLER/PiSA-Lite
|
| 327 |
+
```
|
| 328 |
+
|
| 329 |
+
## Short Description
|
| 330 |
+
|
| 331 |
+
> PiSA-Lite is an unofficial, mobile-optimized PiSA-SR upscaler for Snapdragon smartphones, designed to preserve high-quality textures and semantic image details through Qualcomm's NPU.
|