Real-ESRGAN-General-x4v3 Example
This document describes using the QAI AppBuilder Python API to run inference with the Real-ESRGAN-General-x4v3 super-resolution model on the Qualcomm® Hexagon™ Processor (NPU).
Supported devices
| Device | SoC |
|---|---|
| Dragon Q6A | QCS6490 |
| Dragon Q8B | SC8280XP |
| Fogwise® AIRbox Q900 | QCS9075 |
Install QAI AppBuilder
-
Install QAI AppBuilder by following the QAI AppBuilder installation guide.
-
Configure ADSP environment variables as described in Create ADSP environment variables.
Run the sample
Install dependencies
Install sample dependencies in the activated virtual environment:
pip3 install requests tqdm qai-hub py3-wget Pillow torch torchvision opencv-python-headless
Run the script
-
Enter the upstream samples directory
Devicecd qai-appbuilder/samples
Run inference (Linux requires --chipset, or model download may fail)
- QCS6490
- SC8280XP
- QCS9075
python3 ComputerVision/Super_Resolution/real_esrgan_general_x4v3/real_esrgan_general_x4v3.py --chipset 6490
SC8280XP and QCS6490 both use Hexagon V68. Use --chipset 6490 when downloading models.
python3 ComputerVision/Super_Resolution/real_esrgan_general_x4v3/real_esrgan_general_x4v3.py --chipset 6490
python3 ComputerVision/Super_Resolution/real_esrgan_general_x4v3/real_esrgan_general_x4v3.py --chipset 9075
Expected result
On Dragon Q6A, a successful run writes:
ComputerVision/Super_Resolution/real_esrgan_general_x4v3/output.jpg
Without a display, Error: no DISPLAY environment variable specified may appear; ignore it if the output file exists and the exit code is 0.
Launcher alternative:
python3 run_inference.py --model real_esrgan_general_x4v3 --args "--chipset 6490"