Real-ESRGAN-x4plus 示例
此文档讲述使用 QAI AppBuilder Python API 利用 Qualcomm® Hexagon™ Processor (NPU) 推理 Real-ESRGAN-x4plus 图像超分模型。
示例支持设备
| 设备 | SoC |
|---|---|
| Dragon Q6A | QCS6490 |
| Dragon Q8B | SC8280XP |
| Fogwise® AIRbox Q900 | QCS9075 |
安装 QAI AppBuilder
提示
-
请根据 QAI AppBuilder 安装方法 安装 QAI AppBuilder。
-
请根据 创建 ADSP 环境变量 配置 ADSP 环境变量。
运行示例
安装依赖
在已激活的虚拟环境中安装示例依赖:
Device
pip3 install requests tqdm qai-hub py3-wget Pillow torch torchvision opencv-python-headless
运行脚本
-
进入上游示例目录
Devicecd qai-appbuilder/samples -
准备输入数据(示例自带输入文件时可直接运行;也可按脚本参数指定)

input image
执行推理
注意
在 QCS6490 / SC8280XP 上,不要使用默认 float DLC。默认 .dlc 会报 The SocModel doesn't support FP16 并导致加载失败。请使用 --bin 下载预编译 HTP context binary。
- QCS6490
- SC8280XP
- QCS9075
Device
python3 ComputerVision/Super_Resolution/real_esrgan_x4plus/real_esrgan_x4plus.py --chipset 6490 --bin --no_show
提示
SC8280XP 与 QCS6490 同为 Hexagon V68,下载模型时使用 --chipset 6490,并加 --bin。
Device
python3 ComputerVision/Super_Resolution/real_esrgan_x4plus/real_esrgan_x4plus.py --chipset 6490 --bin --no_show
Device
python3 ComputerVision/Super_Resolution/real_esrgan_x4plus/real_esrgan_x4plus.py --chipset 9075 --no_show
提示
QCS9075 上 Hub 默认下发 .bin(HTP context)即可运行。--no_show 用于无头环境。
--no_show 用于无图形界面的 SSH/无头环境,避免弹出看图窗口。
预期结果
推理成功后会生成:
ComputerVision/Super_Resolution/real_esrgan_x4plus/output.png
日志中可见类似 Inference completed 与输出路径信息。
提示
也可使用启动器:
python3 run_inference.py --model real_esrgan_x4plus --args "--chipset 6490 --bin --no_show"