Views
No views yet
| Model | mAP(0.5) (%) |
|---|---|
| PicoDet-L_layout_17cls | 89.0 |
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 layout_detection \
2 --model_name PicoDet-L_layout_17cls \
3 --threshold 0.6 \
4 -i https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/N5C68HPVAI-xQAWTxpbA6.jpeg1from paddleocr import LayoutDetection
2
3model = LayoutDetection(model_name="PicoDet-L_layout_17cls")
4output = model.predict("N5C68HPVAI-xQAWTxpbA6.jpeg", batch_size=1, threshold=0.6)
5for res in output:
6 res.print()
7 res.save_to_img(save_path="./output/")
8 res.save_to_json(save_path="./output/res.json"){'res': {'input_path': '/root/.paddlex/predict_input/N5C68HPVAI-xQAWTxpbA6.jpeg', 'page_index': None, 'boxes': [{'cls_id': 2, 'label': 'text', 'score': 0.9635457992553711, 'coordinate': [388.77502, 734.85455, 711.20465, 851.34924]}, {'cls_id': 2, 'label': 'text', 'score': 0.9560548067092896, 'coordinate': [35.81832, 645.7974, 361.34726, 849.03186]}, {'cls_id': 8, 'label': 'table', 'score': 0.953098714351654, 'coordinate': [436.3866, 107.82475, 663.87585, 313.641]}, {'cls_id': 8, 'label': 'table', 'score': 0.9468971490859985, 'coordinate': [74.18633, 105.53037, 324.5257, 298.42532]}, {'cls_id': 2, 'label': 'text', 'score': 0.9267896413803101, 'coordinate': [380.26923, 22.14476, 711.83966, 79.47579]}, {'cls_id': 2, 'label': 'text', 'score': 0.9177922606468201, 'coordinate': [386.36615, 498.08298, 713.29956, 698.7275]}, {'cls_id': 2, 'label': 'text', 'score': 0.9103341698646545, 'coordinate': [33.40257, 349.2482, 361.91498, 615.99664]}, {'cls_id': 2, 'label': 'text', 'score': 0.9034966230392456, 'coordinate': [36.185455, 332.4166, 144.946, 345.4999]}, {'cls_id': 2, 'label': 'text', 'score': 0.8902557492256165, 'coordinate': [385.55212, 347.35916, 715.6368, 460.86615]}, {'cls_id': 2, 'label': 'text', 'score': 0.7871182560920715, 'coordinate': [34.448185, 628.47015, 188.9675, 640.77356]}, {'cls_id': 2, 'label': 'text', 'score': 0.7396460771560669, 'coordinate': [428.26053, 477.82913, 692.68634, 490.73227]}, {'cls_id': 2, 'label': 'text', 'score': 0.7116910219192505, 'coordinate': [33.61207, 21.087503, 360.95645, 80.145096]}, {'cls_id': 0, 'label': 'paragraph_title', 'score': 0.6801344752311707, 'coordinate': [394.5478, 716.9035, 526.30695, 730.278]}]}}
1paddleocr table_recognition_v2 -i https://cdn-uploads.huggingface.co/production/uploads/63d7b8ee07cd1aa3c49a2026/tuY1zoUdZsL6-9yGG0MpU.jpeg \
2 --layout_detection_model_name PicoDet-L_layout_17cls \
3 --use_doc_orientation_classify False \
4 --use_doc_unwarping False \
5 --save_path ./output \
6 --device gpu:0
7save_path.1from paddleocr import TableRecognitionPipelineV2
2
3pipeline = TableRecognitionPipelineV2(
4 layout_detection_model_name=PicoDet-L_layout_17cls,
5 use_doc_orientation_classify=False, # Use use_doc_orientation_classify to enable/disable document orientation classification model
6 use_doc_unwarping=False, # Use use_doc_unwarping to enable/disable document unwarping module
7 device="gpu:0", # Use device to specify GPU for model inference
8 )
9
10output = pipeline.predict("tuY1zoUdZsL6-9yGG0MpU.jpeg")
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/")PP-DocLayout-L, so it is needed that specifing to PicoDet-L_layout_17cls by argument layout_detection_model_name. And you can also use the local model file by argument layout_detection_model_dir. For details about usage command and descriptions of parameters, please refer to the Document.