本文档记录 UVDoc 在昇腾 NPU 环境的快速部署与验证结果。
UVDoc 是一个文档图像校正模型 (Text Image Unwarping),主要用于对图像进行几何变换,校正文档扭曲、倾斜、透视变形等问题,使后续文本识别更加准确。
相关获取地址:
| 组件 | 版本 |
|---|---|
torch | 2.9.0+cpu |
torch_npu | 2.9.0.post1+gitee7ba04 |
opencv-python | 4.10.0.84 |
numpy | 1.26.4 |
910B3/workspace/weights/UVDocpip install torch torch_npu -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install opencv-python numpy -i https://pypi.tuna.tsinghua.edu.cn/simplenpu-smi info使用本地图片推理:
python inference.py --input ./test_image.jpg --output ./output| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 输入图像路径 |
| --output | str | ./output | 输出目录 |
| --device | str | auto | 推理设备 (npu/cuda/cpu) |
输入:
./test_image.jpg (任意文档图像)输出:
校正后的文档图像,保存为 ./output/output.jpg说明:
torch_npu 调用 NPU 进行张量运算