CoolFace
Modelpublic

AXERA-TECH/Real-ESRGAN

sourceHugging Facebsd-3-clause-clearupdated 1y agoView on Hugging Face
1likes24downloads
Model Card

Real-ESRGAN

This version of Real-ESRGAN has been converted to run on the Axera NPU using w8a8 quantization.

This model has been optimized with the following LoRA:

Compatible with Pulsar2 version: 3.4

Convert tools links:

For those who are interested in model conversion, you can try to export axmodel through

Support Platform

Chips64x64 -> 256x256256x256 -> 1024x1024
AX65015 ms440 ms
AX630C76 ms2030 ms

How to use

Download all files from this repository to the device

(axcl) axera@raspberrypi:~/samples/realesrgan.axera $ tree -L 2
.
├── ax630c
│   ├── realesrgan-x4-256.axmodel
│   └── realesrgan-x4.axmodel
├── ax650
│   ├── realesrgan-x4-256.axmodel
│   └── realesrgan-x4.axmodel
├── config.json
├── main.py
├── onnx
│   ├── realesrgan-x4-256.onnx
│   └── realesrgan-x4.onnx
├── output_test_256.jpg
├── out_test-256.jpg
└── test_256.jpeg

3 directories, 11 file

python env requirement

pyaxengine

https://github.com/AXERA-TECH/pyaxengine

wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3rc0/axengine-0.1.3-py3-none-any.whl
pip install axengine-0.1.3-py3-none-any.whl
others
pip install argparse numpy opencv-python

Inference with AX630C Host, such as Module-LLM, LLM630 Compute Kit

root@ax630c:/mnt/qtang/realesrgan.axera# python3 main.py --input test_256.jpeg --output test_256_20e.jpeg --model ax630/realesrgan-x4-256.axmodel
[INFO] Available providers:  ['AxEngineExecutionProvider']
[INFO] Using provider: AxEngineExecutionProvider
[INFO] Chip type: ChipType.MC20E
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Engine version: 2.7.2a
[INFO] Model type: 1 (full core)
[INFO] Compiler version: 3.4 3dfd5692
input.1 [1, 256, 256, 3] uint8
1895 [1, 1024, 1024, 3] float32
Original Image Shape: (243, 243, 3)
Preprocessed Image Shape: (1, 256, 256, 3)
Inference Time: 2066.72 ms
Output Shape: (1, 1024, 1024, 3)
Final Output Image Shape: (1024, 1024, 3)
root@ax630c:/mnt/qtang/realesrgan.axera# 

Inference with M.2 Accelerator card

What is M.2 Accelerator card?, Show this DEMO based on Raspberry PI 5.

(axcl) axera@raspberrypi:~/samples/realesrgan.axera $ python main.py --input test_256.jpeg --output output_test_256.jpg --model realesrgan-x4-256.axmodel
[INFO] Available providers:  ['AXCLRTExecutionProvider']
[INFO] Using provider: AXCLRTExecutionProvider
[INFO] SOC Name: AX650N
[INFO] VNPU type: VNPUType.DISABLED
[INFO] Compiler version: 3.4 3dfd5692
input.1 [1, 256, 256, 3] uint8
<cdata 'char *' 0x262e54e0> [1, 1024, 1024, 3] float32
Original Image Shape: (243, 243, 3)
Preprocessed Image Shape: (1, 256, 256, 3)
Inference Time: 455.81 ms
Output Shape: (1, 1024, 1024, 3)
Final Output Image Shape: (1024, 1024, 3)
(axcl) axera@raspberrypi:~/samples/realesrgan.axera $

Input [image]

Output [image]