Views
No views yet
| Model | Accuracy (%) | GPU Inference Time (ms) [Normal Mode / High Performance Mode] | CPU Inference Time (ms) [Normal Mode / High Performance Mode] | Model Storage Size (M) |
|---|---|---|---|---|
| SLANeXt_wireless | 69.65 | -- | -- | 351M |
1# for CUDA11.8
2python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
3
4# for CUDA12.6
5python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
6
7# for CPU
8python -m pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/python -m pip install paddleocr1paddleocr table_structure_recognition \
2 --model_name SLANeXt_wireless \
3 -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/6rfhb-CXOHowonjpBsaUJ.png1from paddleocr import TableStructureRecognition
2model = TableStructureRecognition(model_name="SLANeXt_wireless")
3output = model.predict(input="6rfhb-CXOHowonjpBsaUJ.png", batch_size=1)
4for res in output:
5 res.print(json_format=False)
6 res.save_to_json("./output/res.json"){'res': {'input_path': '6rfhb-CXOHowonjpBsaUJ.png', 'page_index': None, 'bbox': [[5, 4, 48, 5, 46, 85, 5, 81], [84, 6, 146, 6, 143, 101, 83, 98], [186, 6, 217, 6, 212, 104, 184, 98], [239, 7, 281, 8, 276, 107, 235, 108], [324, 6, 405, 6, 404, 105, 323, 106], [405, 4, 488, 5, 488, 100, 403, 94], [3, 56, 96, 60, 95, 187, 3, 180], [108, 68, 157, 71, 159, 193, 110, 187], [179, 75, 207, 79, 211, 199, 184, 192], [238, 72, 277, 76, 281, 203, 243, 199], [318, 68, 400, 70, 404, 207, 325, 205], [395, 66, 494, 68, 494, 214, 397, 212], [11, 138, 62, 145, 68, 329, 12, 321], [105, 151, 156, 158, 171, 332, 117, 323], [177, 157, 210, 166, 229, 322, 197, 312], [232, 152, 276, 159, 295, 322, 253, 316], [313, 142, 396, 147, 409, 330, 332, 326], [392, 139, 491, 144, 492, 332, 404, 330], [3, 239, 86, 254, 103, 450, 3, 445], [97, 251, 152, 261, 176, 458, 116, 454], [172, 254, 211, 265, 239, 461, 200, 458], [235, 248, 289, 257, 316, 466, 264, 464], [310, 235, 402, 242, 419, 469, 337, 468], [381, 229, 491, 236, 492, 469, 400, 468], [9, 340, 74, 361, 88, 490, 11, 489], [95, 338, 129, 353, 150, 493, 113, 492], [176, 342, 192, 358, 221, 493, 206, 492], [235, 335, 261, 351, 289, 493, 265, 492], [310, 325, 372, 339, 393, 493, 338, 493], [382, 321, 482, 334, 485, 493, 402, 493]], 'structure': ['<html>', '<body>', '<table>', '<tr>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '</tr>', '<tr>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '</tr>', '<tr>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '</tr>', '<tr>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '</tr>', '<tr>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '<td></td>', '</tr>', '</table>', '</body>', '</html>'], 'structure_score': 0.9999998}}1
2paddleocr table_recognition_v2 -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mabagznApI1k9R8qFoTLc.png \
3 --use_doc_orientation_classify False \
4 --use_doc_unwarping False \
5 --save_path ./output \
6 --device gpu:0 1{'res': {'input_path': 'mabagznApI1k9R8qFoTLc.png', 'page_index': None, 'model_settings': {'use_doc_preprocessor': False, 'use_layout_detection': True, 'use_ocr_model': True}, 'layout_det_res': {'input_path': None, 'page_index': None, 'boxes': [{'cls_id': 8, 'label': 'table', 'score': 0.86655592918396, 'coordinate': [0.0125130415, 0.41920784, 1281.3737, 585.3884]}]}, 'overall_ocr_res': {'input_path': None, 'page_index': None, 'model_settings': {'use_doc_preprocessor': False, 'use_textline_orientation': False}, 'dt_polys': array([[[ 9, 21],
2 ...,
3 [ 9, 59]],
4
5 ...,
6
7 [[1046, 536],
8 ...,
9 [1046, 573]]], dtype=int16), 'text_det_params': {'limit_side_len': 960, 'limit_type': 'max', 'thresh': 0.3, 'box_thresh': 0.6, 'unclip_ratio': 2.0}, 'text_type': 'general', 'textline_orientation_angles': array([-1, ..., -1]), 'text_rec_score_thresh': 0, 'rec_texts': ['部门', '报销人', '报销事由', '批准人:', '单据', '张', '合计金额', '元', '车费票', '其', '火车费票', '飞机票', '中', '旅住宿费', '其他', '补贴'], 'rec_scores': array([0.99958128, ..., 0.99317062]), 'rec_polys': array([[[ 9, 21],
10 ...,
11 [ 9, 59]],
12
13 ...,
14
15 [[1046, 536],
16 ...,
17 [1046, 573]]], dtype=int16), 'rec_boxes': array([[ 9, ..., 59],
18 ...,
19 [1046, ..., 573]], dtype=int16)}, 'table_res_list': [{'cell_box_list': [array([ 0.13052222, ..., 73.08310249]), array([104.43082511, ..., 73.27777413]), array([319.39041221, ..., 73.30439308]), array([424.2436837 , ..., 73.44736794]), array([580.75836265, ..., 73.24003914]), array([723.04370201, ..., 73.22717598]), array([984.67315757, ..., 73.20420387]), array([1.25130415e-02, ..., 5.85419208e+02]), array([984.37072837, ..., 137.02281502]), array([984.26586998, ..., 201.22290352]), array([984.24017417, ..., 585.30775765]), array([1039.90606773, ..., 265.44664314]), array([1039.69549644, ..., 329.30540779]), array([1039.66546714, ..., 393.57319954]), array([1039.5122689 , ..., 457.74644783]), array([1039.55535972, ..., 521.73030403]), array([1039.58612144, ..., 585.09468392])], 'pred_html': '<html><body><table><tbody><tr><td>部门</td><td></td><td>报销人</td><td></td><td>报销事由</td><td></td><td colspan="2">批准人:</td></tr><tr><td colspan="6" rowspan="8"></td><td colspan="2">单据 张</td></tr><tr><td colspan="2">合计金额 元</td></tr><tr><td rowspan="6">其 中</td><td>车费票</td></tr><tr><td>火车费票</td></tr><tr><td>飞机票</td></tr><tr><td>旅住宿费</td></tr><tr><td>其他</td></tr><tr><td>补贴</td></tr></tbody></table></body></html>', 'table_ocr_pred': {'rec_polys': array([[[ 9, 21],
20 ...,
21 [ 9, 59]],
22
23 ...,
24
25 [[1046, 536],
26 ...,
27 [1046, 573]]], dtype=int16), 'rec_texts': ['部门', '报销人', '报销事由', '批准人:', '单据', '张', '合计金额', '元', '车费票', '其', '火车费票', '飞机票', '中', '旅住宿费', '其他', '补贴'], 'rec_scores': array([0.99958128, ..., 0.99317062]), 'rec_boxes': array([[ 9, ..., 59],
28 ...,
29 [1046, ..., 573]], dtype=int16)}}]}}save_path. The visualization output is shown below:
1from paddleocr import TableRecognitionPipelineV2
2
3pipeline = TableRecognitionPipelineV2(
4 use_doc_orientation_classify=False, # Use use_doc_orientation_classify to enable/disable document orientation classification model
5 use_doc_unwarping=False, # Use use_doc_unwarping to enable/disable document unwarping module
6)
7# pipeline = TableRecognitionPipelineV2(use_doc_orientation_classify=True) # Specify whether to use the document orientation classification model with use_doc_orientation_classify
8# pipeline = TableRecognitionPipelineV2(use_doc_unwarping=True) # Specify whether to use the text image unwarping module with use_doc_unwarping
9# pipeline = TableRecognitionPipelineV2(device="gpu") # Specify the device to use GPU for model inference
10output = pipeline.predict("https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mabagznApI1k9R8qFoTLc.png")
11for res in output:
12 res.print() ## Print the predicted structured output
13 res.save_to_img("./output/")
14 res.save_to_xlsx("./output/")
15 res.save_to_html("./output/")
16 res.save_to_json("./output/")1paddleocr pp_structurev3 -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mG4tnwfrvECoFMu-S9mxo.png \
2 --use_doc_orientation_classify False \
3 --use_doc_unwarping False \
4 --use_textline_orientation False \
5 --device gpu:0save_path.1from paddleocr import PPStructureV3
2
3pipeline = PPStructureV3(
4 use_doc_orientation_classify=False, # Use use_doc_orientation_classify to enable/disable document orientation classification model
5 use_doc_unwarping=False, # Use use_doc_unwarping to enable/disable document unwarping module
6 use_textline_orientation=False, # Use use_textline_orientation to enable/disable textline orientation classification model
7 device="gpu:0", # Use device to specify GPU for model inference
8 )
9output = pipeline.predict(".mG4tnwfrvECoFMu-S9mxo.png")
10for res in output:
11 res.print() # Print the structured prediction output
12 res.save_to_json(save_path="output") ## Save the current image's structured result in JSON format
13 res.save_to_markdown(save_path="output") ## Save the current image's result in Markdown format