--- pipeline_tag: image-to-image --- # 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: 4.2 ## Convert tools links: For those who are interested in model conversion, you can try to export axmodel through - [The repo of AXera Platform](https://github.com/AXERA-TECH/Real-ESRGAN.axera), which you can get the detail 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|model|cost| |--|--|--| |AX650|realesrgan-x2|15.6 ms| |AX650|realesrgan-x4|62.1 ms| ## How to use Download all files from this repository to the device ``` root@ax650:~/realesrgan# tree . |-- model | `-- realesrgan-x2.axmodel | `-- realesrgan-x4.axmodel |`-- run_onnx.py |`-- run_axmodel.py |`-- build_config.json |`-- requirements.txt ``` ### Inference ``` Input Data: |-- pics | `-- 00003.png | `-- 00017_gray.png | `-- 0014.jpg | `-- 0030.jpg | `-- ADE_val_00000114.jpg | `-- OST_009.png | `-- children-alpha.png | `-- tree_alpha_16bit.png | `-- wolf_gray.jpg ``` #### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro) run image ``` root@ax650 ~/realesrgan #python3 run_axmodel.py --input ./pics --outscale 2 --model_path ./realesrgan-x2.axmodel [INFO] Available providers: ['AxEngineExecutionProvider'] Testing 0 00003 [INFO] Using provider: AxEngineExecutionProvider [INFO] Chip type: ChipType.MC50 [INFO] VNPU type: VNPUType.DISABLED [INFO] Engine version: 2.12.0s [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 1 00017_gray [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 2 0014 [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 3 0030 [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 4 ADE_val_00000114 [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 5 OST_009 [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 6 children-alpha [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 7 tree_alpha_16bit Input is a 16-bit image [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty Testing 8 wolf_gray [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty ``` Output: ![output](results/2.png) run video ``` root@ax650 ~/realesrgan #python3 run_video.py -i demo.mp4 -s 2 -m realesrgan-x2.axmodel [INFO] Available providers: ['AxEngineExecutionProvider'] [INFO] Using provider: AxEngineExecutionProvider [INFO] Chip type: ChipType.MC50 [INFO] VNPU type: VNPUType.DISABLED [INFO] Engine version: 2.12.0s [INFO] Model type: 2 (triple core) [INFO] Compiler version: 4.2-dirty 5e72cf06-dirty 100%|█████████████████████████████████████████| 181/181 [02:09<00:00, 1.40it/s] ```