z
zkx_/cv_dla34_table-structure-recognition_cycle-centernet-ascend
模型介绍文件和版本Pull Requests讨论分析

cv_dla34_table-structure-recognition_cycle-centernet on Ascend NPU

1. 简介

本文档记录 DLASeg 表格结构识别模型在昇腾 NPU (Ascend 910B3) 上的迁移适配与精度验证结果。

该模型基于 DLA34 (Deep Layer Aggregation) 骨干网络和 CenterNet 检测头,用于识别表格中的单元格结构(行/列分割),输出包括热力图(hm)、中心点偏移(reg)等。

相关获取地址:

  • 权重下载地址(ModelScope):https://modelscope.cn/models/damo/cv_dla34_table-structure-recognition_cycle-centernet
  • 权重下载地址(HuggingFace Mirror):https://hf-mirror.com/damo/cv_dla34_table-structure-recognition_cycle-centernet

参考文档:

  • https://modelscope.cn/models/damo/cv_dla34_table-structure-recognition_cycle-centernet

2. 验证环境

组件版本
CANN8.5.1
torch2.8.0
torch_npu2.8.0.post4
modelscope1.37.0
opencv-python-headless4.13.0
  • NPU:Ascend 910B3,单卡推理
  • 模型大小:约 18.6M 参数
  • 输入:[1, 3, 512, 512] RGB 图像

3. 推理启动

3.1 环境准备

conda create -n cv_dla34_table-structure-recognition_cycle-centernet python=3.10 -y
conda activate cv_dla34_table-structure-recognition_cycle-centernet

pip install torch==2.8.0 torch_npu==2.8.0.post4 torchvision==0.23.0 \
    -i https://mirrors.huaweicloud.com/repository/pypi/simple \
    --trusted-host mirrors.huaweicloud.com

pip install modelscope opencv-python-headless numpy \
    sortedcontainers simplejson addict datasets pyarrow Pillow \
    -i https://mirrors.huaweicloud.com/repository/pypi/simple \
    --trusted-host mirrors.huaweicloud.com

3.2 下载模型权重

modelscope download --model damo/cv_dla34_table-structure-recognition_cycle-centernet \
    --local_dir ./cv_dla34_table-structure-recognition_cycle-centernet

3.3 命令行推理

python inference.py --image table.jpg --device npu

3.4 Python API

from inference import run_inference
result = run_inference("table.jpg", device="npu")
print(f"耗时: {result['time_ms']:.1f}ms")

4. Smoke 验证

python evaluate.py

验证结果:

  • CPU 推理正常,输出热力图
  • NPU 推理正常,输出同形状
  • 精度评测通过

5. 性能参考

测试条件:input [1, 3, 512, 512]。

指标CPUNPU (Ascend 910B3)
推理耗时1894 ms20 ms
加速比—94x

6. 精度评测

6.1 评测方法

对比 CPU (PyTorch) 与 NPU (torch_npu) 在相同随机输入下模型输出热力图 (hm) 的鲁棒平均相对误差(|value| > 0.01)。

6.2 评测结果

指标数值
鲁棒平均相对误差0.0137%
精度要求平均相对误差 < 1%
精度评测通过

7. 注意事项

  1. 模型接口:通过 pipeline.infer_model 获取 DLASeg 模型,输出包含 hm、v2c、c2v、reg 等多头
  2. 输入尺寸:固定 512×512,预处理需 resize
  3. 应用场景:配合 OCR 文字识别实现完整的表格结构化提取
  4. 首次推理:NPU 首次推理有算子编译开销(约 10-20s),后续稳定在 ~20ms
下载使用量0