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

Chips 64x64 -> 256x256 256x256 -> 1024x1024
AX650 15 ms 440 ms
AX630C 76 ms 2030 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

Output

Downloads last month
3
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including AXERA-TECH/Real-ESRGAN