File size: 3,958 Bytes
7a6a599 45767e2 7a6a599 c4a6379 145f592 7a6a599 145f592 7a6a599 145f592 7a6a599 145f592 7a6a599 145f592 7a6a599 145f592 7a6a599 145f592 7a6a599 6207b39 7a6a599 6207b39 7a6a599 447b4e0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
---
license: bsd-3-clause-clear
language:
- en
pipeline_tag: image-to-image
tags:
- Real-ESRGAN
- SR
- Int8
---
# 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
- [The repo of original](https://github.com/xinntao/Real-ESRGAN)
- [The repo of AXera Platform](https://github.com/AXERA-TECH/realesrgan.axera), which you can get the detial of guide
- [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html)
## Support Platform
- AX650
- [M4N-Dock(η±θ―ζ΄ΎPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
- AX630C
- [η±θ―ζ΄Ύ2](https://axera-pi-2-docs-cn.readthedocs.io/zh-cn/latest/index.html)
- [Module-LLM](https://docs.m5stack.com/zh_CN/module/Module-LLM)
- [LLM630 Compute Kit](https://docs.m5stack.com/zh_CN/core/LLM630%20Compute%20Kit)
|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?](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html), 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**

|