• PaddleOCR Structure表格识别


    1. 安装依赖包

    # 安装 paddleocr,推荐使用2.5+版本
    pip3 install "paddleocr>=2.5"
    # 安装 版面分析依赖包layoutparser(如不需要版面分析功能,可跳过)
    pip3 install -U https://paddleocr.bj.bcebos.com/whl/layoutparser-0.0.0-py3-none-any.whl
    # 安装 DocVQA依赖包paddlenlp(如不需要DocVQA功能,可跳过)
    pip install paddlenlp
    

    2. 便捷使用

    2.1 命令行使用

    2.1.1 版面分析+表格识别

    paddleocr --image_dir=PaddleOCR/ppstructure/docs/table/1.png --type=structure
    

    2.1.2 版面分析

    paddleocr --image_dir=PaddleOCR/ppstructure/docs/table/1.png --type=structure --table=false --ocr=false
    

    2.1.3 表格识别

    paddleocr --image_dir=PaddleOCR/ppstructure/docs/table/table.jpg --type=structure --layout=false
    

    2.2 参数说明

    字段 说明 默认值
    output excel和识别结果保存的地址 ./output/table
    table_max_len 表格结构模型预测时,图像的长边resize尺度 488
    table_model_dir 表格结构模型 inference 模型地址 None
    table_char_dict_path 表格结构模型所用字典地址 ../ppocr/utils/dict/table_structure_dict.txt
    layout_path_model 版面分析模型模型地址,可以为在线地址或者本地地址,当为本地地址时,需要指定 layout_label_map, 命令行模式下可通过--layout_label_map='{0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"}' 指定 lp://PubLayNet/ppyolov2_r50vd_dcn_365e_publaynet/config
    layout_label_map 版面分析模型模型label映射字典 None
    model_name_or_path VQA SER模型地址 None
    max_seq_length VQA SER模型最大支持token长度 512
    label_map_path VQA SER 标签文件地址 ./vqa/labels/labels_ser.txt
    layout 前向中是否执行版面分析 True
    table 前向中是否执行表格识别 True
    ocr 对于版面分析中的非表格区域,是否执行ocr。当layout为False时会被自动设置为False True
    structure_version 表格结构化模型版本,可选 PP-STRUCTURE。PP-STRUCTURE支持表格结构化模型 PP-STRUCTURE

    3. 模型下载

    3.1 版面分析模型

    模型名称 模型简介 下载地址 label_map
    ppyolov2_r50vd_dcn_365e_publaynet PubLayNet 数据集训练的版面分析模型,可以划分文字、标题、表格、图片以及列表5类区域 推理模型 / 训练模型 {0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"}
    ppyolov2_r50vd_dcn_365e_tableBank_word TableBank Word 数据集训练的版面分析模型,只能检测表格 推理模型 {0:"Table"}
    ppyolov2_r50vd_dcn_365e_tableBank_latex TableBank Latex 数据集训练的版面分析模型,只能检测表格 推理模型 {0:"Table"}

    3.2 OCR模型

    模型名称 模型简介 推理模型大小 下载地址
    en_ppocr_mobile_v2.0_table_det PubLayNet数据集训练的英文表格场景的文字检测 4.7M 推理模型 / 训练模型
    en_ppocr_mobile_v2.0_table_rec PubLayNet数据集训练的英文表格场景的文字识别 6.9M 推理模型 / 训练模型

    如需要使用其他OCR模型,可以在 PP-OCR model_list 下载模型或者使用自己训练好的模型配置到 det_model_dir, rec_model_dir两个字段即可。

    3.3 表格识别模型

    模型名称 模型简介 推理模型大小 下载地址
    en_ppocr_mobile_v2.0_table_structure PubLayNet数据集训练的英文表格场景的表格结构预测 18.6M 推理模型 / 训练模型

    3.4 VQA模型

    模型名称 模型简介 推理模型大小 下载地址
    ser_LayoutXLM_xfun_zh 基于LayoutXLM在xfun中文数据集上训练的SER模型 1.4G 推理模型 coming soon / 训练模型
    re_LayoutXLM_xfun_zh 基于LayoutXLM在xfun中文数据集上训练的RE模型 1.4G 推理模型 coming soon / 训练模型
    ser_LayoutLMv2_xfun_zh 基于LayoutLMv2在xfun中文数据集上训练的SER模型 778M 推理模型 coming soon / 训练模型
    re_LayoutLMv2_xfun_zh 基于LayoutLMv2在xfun中文数据集上训练的RE模型 765M 推理模型 coming soon / 训练模型
    ser_LayoutLM_xfun_zh 基于LayoutLM在xfun中文数据集上训练的SER模型 430M 推理模型 coming soon / 训练模型

    3.5 KIE模型

    模型名称 模型简介 模型大小 下载地址
    SDMGR 关键信息提取模型 78M 推理模型 coming soon / 训练模型
  • 相关阅读:
    Azure DevOps 介绍
    vs如何将attach to process放入到toolbar中,以方便调试
    AtCoder Regular Contest 133
    Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) AE 题解
    LGP6326 Shopping 点分治+dp
    CF527E Data Center Drama
    Silverlight Expression Blend之ImageButton
    Expression Blend实战开发技巧——ImageButton详解
    uniapp安卓NFC读取
    uniapp拖动/缩放nvue页面
  • 原文地址:https://www.cnblogs.com/zwbsoft/p/16281917.html
Copyright © 2020-2023  润新知