EasyOCR 示例
此文档讲述使用 QAI AppBuilder Python API 利用 Qualcomm® Hexagon™ Processor (NPU) 推理 EasyOCR 文本识别模型。
示例支持设备
| 设备 | SoC |
|---|---|
| Fogwise® AIRbox Q900 | QCS9075 |
安装 QAI AppBuilder
提示
-
请根据 QAI AppBuilder 安装方法 安装 QAI AppBuilder。
-
请根据 创建 ADSP 环境变量 配置 ADSP 环境变量。
运行示例
安装依赖
Device
pip3 install requests tqdm qai-hub py3_wget opencv-python torch torchvision matplotlib easyocr qai_hub_models
运行脚本
-
进入示例目录
- QCS9075
Devicecd ai-engine-direct-helper/samples/python -
准备输入图片,这里以以下图片为输入示例

input image
-
执行推理
Devicepython3 easy_ocr/easy_ocr.py$ python3 easy_ocr/easy_ocr.py
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:38:dummy call to rpcmem_init, rpcmem APIs will be used from libxdsprpc
Calling EasyOCR_Detector::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
Calling EasyOCR_Recognizer::Inference on NPU
白日依山尽
黄河入海流
欲穷千里目
更上一层楼
The sun beyond the mountain glows,
The Yellow River seawards flows_
You can enjoy a grander sight,
By climbing to a greater height。
Demo image display is disabled by default for remote servers. To override, set `QAIHM_ALWAYS_DISPLAY_OUTPUT=1` in your environment.
Saving image to /mnt/ssd/qualcomm/702/zzf_fork/test/ai-engine-direct-helper/samples/python/build/image.png
<W> Logs will be sent to the system's default channel
/prj/qct/webtech_scratch20/mlg_user_admin/qaisw_source_repo/rel/qairt-2.37.1/point_release/SNPE_SRC/avante-tools/prebuilt/dsp/hexagon-sdk-5.5.5/ipc/fastrpc/rpcmem/src/rpcmem_android.c:42:dummy call to rpcmem_deinit, rpcmem APIs will be used from libxdsprpc识别结果
白日依山尽
黄河入海流
欲穷千里目
更上一层楼
The sun beyond the mountain glows,
The Yellow River seawards flows_
You can enjoy a grander sight,
By climbing to a greater height。