🚀 PP-LCNet_x1_0_table_cls
PP-LCNet_x1_0_table_cls是表格分类模块的重要模型,可对输入的表格图像进行分类,其性能直接影响整个表格识别流程的准确性和效率。
🚀 快速开始
你可以通过以下步骤快速体验PP-LCNet_x1_0_table_cls模型的功能:
模型使用
paddleocr table_classification \
-i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/6rfhb-CXOHowonjpBsaUJ.png
管道使用
通用表格识别V2管道
paddleocr table_recognition_v2 -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mabagznApI1k9R8qFoTLc.png \
--use_doc_orientation_classify False \
--use_doc_unwarping False \
--save_path ./output \
--device gpu:0
PP-StructureV3
paddleocr pp_structurev3 -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mG4tnwfrvECoFMu-S9mxo.png \
--use_doc_orientation_classify False \
--use_doc_unwarping False \
--use_textline_orientation False \
--device gpu:0
✨ 主要特性
表格分类模块是计算机视觉系统中的关键组件,负责对输入的表格图像进行分类。该模块通常接收表格图像作为输入,并使用深度学习算法根据图像的特征和内容将其分类为预定义的类别,如有线表格和无线表格。表格分类模块的分类结果作为输出,用于表格识别管道。关键指标如下:
模型 |
Top1准确率(%) |
GPU推理时间 (ms) [常规模式 / 高性能模式] |
CPU推理时间 (ms) [常规模式 / 高性能模式] |
模型存储大小 (M) |
PP-LCNet_x1_0_table_cls |
94.2 |
2.35 / 0.47 |
4.03 / 1.35 |
6.6M |
📦 安装指南
1. PaddlePaddle
请参考以下命令,使用pip安装PaddlePaddle:
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
python -m pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
有关PaddlePaddle安装的详细信息,请参考PaddlePaddle官方网站。
2. PaddleOCR
从PyPI安装最新版本的PaddleOCR推理包:
python -m pip install paddleocr
💻 使用示例
基础用法
from paddleocr import TableClassification
model = TableClassification(model_name="PP-LCNet_x1_0_table_cls")
output = model.predict("mabagznApI1k9R8qFoTLc.png", batch_size=1)
for res in output:
res.print(json_format=False)
res.save_to_json("./output/res.json")
res.save_to_img("./output/res.png")
运行后,得到的结果如下:
{'res': {'input_path': 'mabagznApI1k9R8qFoTLc.png', 'page_index': None, 'class_ids': array([1, 0], dtype=int32), 'scores': array([0.79982, 0.20018], dtype=float32), 'label_names': ['wireless_table', 'wired_table']}}
可视化图像如下:

高级用法
通用表格识别V2管道
from paddleocr import TableRecognitionPipelineV2
pipeline = TableRecognitionPipelineV2(
use_doc_orientation_classify=False,
use_doc_unwarping=False,
)
output = pipeline.predict("https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mabagznApI1k9R8qFoTLc.png")
for res in output:
res.print()
res.save_to_img("./output/")
res.save_to_xlsx("./output/")
res.save_to_html("./output/")
res.save_to_json("./output/")
PP-StructureV3
from paddleocr import PPStructureV3
pipeline = PPStructureV3(
use_doc_orientation_classify=False,
use_doc_unwarping=False,
use_textline_orientation=False,
device="gpu:0",
)
output = pipeline.predict("mG4tnwfrvECoFMu-S9mxo.png")
for res in output:
res.print()
res.save_to_json(save_path="output")
res.save_to_markdown(save_path="output")
有关使用命令和参数说明的详细信息,请参考文档。
📚 详细文档
📄 许可证
本项目采用Apache-2.0许可证。