pdf-icon

Product Guide

Offline Voice Recognition

Industrial Control

IoT Measuring Instruments

Air Quality

Module13.2 PPS

Ethernet Camera

DIP Switch Usage Guide

Module GPS v2.0

Module GNSS

Module ExtPort For Core2

Module LoRa868 V1.2

Real-ESRGAN

Real-ESRGAN is a deep learning-based image super-resolution model that can effectively remove noise while restoring details in low-resolution images, and is widely used in image and video enhancement processing.

  1. Manually download the model and upload it to raspberrypi5, or pull the model repository using the following command.
Note
If git lfs is not installed, please refer to git lfs installation instructions for installation.
git clone https://huggingface.co/AXERA-TECH/Real-ESRGAN

File Description:

m5stack@raspberrypi:~/rsp/Real-ESRGAN $ ls -lh
total 428K
drwxrwxr-x 2 m5stack m5stack 4.0K Aug 13 09:12 ax630c
drwxrwxr-x 2 m5stack m5stack 4.0K Aug 13 09:12 ax650
-rw-rw-r-- 1 m5stack m5stack    0 Aug 13 09:11 config.json
-rw-rw-r-- 1 m5stack m5stack 2.9K Aug 13 09:11 main.py
drwxrwxr-x 2 m5stack m5stack 4.0K Aug 13 09:12 onnx
-rw-rw-r-- 1 m5stack m5stack 387K Aug 13 09:12 output_test_256.jpg
-rw-rw-r-- 1 m5stack m5stack 3.9K Aug 13 09:11 README.md
-rw-rw-r-- 1 m5stack m5stack  19K Aug 13 09:11 test_256.jpeg
  1. Create a virtual environment
python -m venv esrgan
  1. Activate the virtual environment
source esrgan/bin/activate
  1. Install dependencies
pip install https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc1/axengine-0.1.3-py3-none-any.whl
pip install argparse numpy opencv-python
  1. Run
python3 main.py --input test_256.jpeg --output test_256_20e.jpeg --model ax650/realesrgan-x4-256.axmodel

Execution result:

(esrgan) m5stack@raspberrypi:~/rsp/Real-ESRGAN $ python3 main.py --input test_256.jpeg --output test_256_20e.jpeg --model ax650/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
1895 [1, 1024, 1024, 3] float32
Original Image Shape: (243, 243, 3)
Preprocessed Image Shape: (1, 256, 256, 3)
Inference Time: 454.03 ms
Output Shape: (1, 1024, 1024, 3)
Final Output Image Shape: (1024, 1024, 3)

Original image:

Output:

On This Page