Image-to-Text
MLX
Safetensors
mlx-weights
paddlepaddle-ocr
ppocrv5
ppocrv6
ppdoclayoutv3
pp-structure
apple-silicon
Instructions to use plaincompute/ppocr-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use plaincompute/ppocr-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir ppocr-mlx plaincompute/ppocr-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- det/.gitattributes +35 -0
- det/config.json +15 -0
- det/mlx_det_model.safetensors +3 -0
- det/model.mlx.safetensors +3 -0
- det/model.safetensors +3 -0
- det/preprocessor_config.json +30 -0
- det_v6_medium/.gitattributes +35 -0
- det_v6_medium/README.md +188 -0
- det_v6_medium/config.json +59 -0
- det_v6_medium/inference.yml +52 -0
- det_v6_medium/model.mlx.safetensors +3 -0
- det_v6_medium/model.safetensors +3 -0
- det_v6_medium/preprocessor_config.json +34 -0
- det_v6_small/.gitattributes +35 -0
- det_v6_small/README.md +188 -0
- det_v6_small/config.json +36 -0
- det_v6_small/inference.yml +52 -0
- det_v6_small/model.mlx.safetensors +3 -0
- det_v6_small/model.safetensors +3 -0
- det_v6_small/preprocessor_config.json +34 -0
- det_v6_tiny/.gitattributes +35 -0
- det_v6_tiny/README.md +188 -0
- det_v6_tiny/config.json +36 -0
- det_v6_tiny/inference.yml +52 -0
- det_v6_tiny/model.mlx.safetensors +3 -0
- det_v6_tiny/model.safetensors +3 -0
- det_v6_tiny/preprocessor_config.json +34 -0
- doclayoutv3/.gitattributes +35 -0
- doclayoutv3/config.json +107 -0
- doclayoutv3/inference.yml +100 -0
- doclayoutv3/model.mlx.safetensors +3 -0
- doclayoutv3/model.safetensors +3 -0
- doclayoutv3/preprocessor_config.json +36 -0
- en_rec/.gitattributes +35 -0
- en_rec/README.md +3 -0
- en_rec/config.json +154 -0
- en_rec/inference.yml +479 -0
- en_rec/model.mlx.safetensors +3 -0
- en_rec/model.safetensors +3 -0
- en_rec/preprocessor_config.json +457 -0
- formula/.gitattributes +35 -0
- formula/FORMULA_MODEL_SUMMARY.md +382 -0
- formula/README.md +3 -0
- formula/config.json +47 -0
- formula/formula_model_tree.json +0 -0
- formula/generation_config.json +10 -0
- formula/inference.yml +0 -0
- formula/model.mlx.safetensors +3 -0
- formula/model.safetensors +3 -0
- formula/processor_config.json +21 -0
det/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
det/config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv5_mobile_det",
|
| 3 |
+
"reduction":4,
|
| 4 |
+
"layer_list_out_channels": [12, 18, 42, 360],
|
| 5 |
+
"backbone_config": {
|
| 6 |
+
"model_type": "pp_lcnet_v3",
|
| 7 |
+
"scale": 0.75,
|
| 8 |
+
"out_features": ["stage2", "stage3", "stage4", "stage5"],
|
| 9 |
+
"out_indices": [2, 3, 4, 5],
|
| 10 |
+
"divisor": 16
|
| 11 |
+
},
|
| 12 |
+
"neck_out_channels": 96,
|
| 13 |
+
"kernel_list": [3, 2, 2],
|
| 14 |
+
"interpolate_mode": "nearest"
|
| 15 |
+
}
|
det/mlx_det_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:582f6fbb7247f429d7f1af35d61c023ed025734561886a4df384e15ede53e3b0
|
| 3 |
+
size 14231969
|
det/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a29698d97e7369d538c5fdc63ff24a61139cce24de69dab17e7b67f8d4235c8a
|
| 3 |
+
size 14332418
|
det/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c49eea87d579f931c79bf29ac1ffb1b3166f86f6811b8e46b982bb66e3f0f287
|
| 3 |
+
size 14330820
|
det/preprocessor_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_valid_processor_keys": [
|
| 3 |
+
"images",
|
| 4 |
+
"do_resize",
|
| 5 |
+
"size",
|
| 6 |
+
"resample",
|
| 7 |
+
"do_rescale",
|
| 8 |
+
"rescale_factor",
|
| 9 |
+
"do_normalize",
|
| 10 |
+
"image_mean",
|
| 11 |
+
"image_std",
|
| 12 |
+
"return_tensors",
|
| 13 |
+
"data_format",
|
| 14 |
+
"input_data_format"
|
| 15 |
+
],
|
| 16 |
+
"do_normalize": true,
|
| 17 |
+
"do_rescale": true,
|
| 18 |
+
"do_resize": true,
|
| 19 |
+
"model_type": "pp_ocrv5_mobile_det",
|
| 20 |
+
"model_input_names": ["pixel_values", "original_image_size"],
|
| 21 |
+
"image_mode": "BGR",
|
| 22 |
+
"channel_first": false,
|
| 23 |
+
"limit_side_len": 960,
|
| 24 |
+
"max_side_limit": 4000,
|
| 25 |
+
"image_mean": [0.406, 0.456, 0.485],
|
| 26 |
+
"image_std": [0.225, 0.224, 0.229],
|
| 27 |
+
"rescale_factor": 0.00392156862745098,
|
| 28 |
+
"resample": 2,
|
| 29 |
+
"keep_keys": ["image", "shape", "polys", "ignore_tags"]
|
| 30 |
+
}
|
det_v6_medium/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
det_v6_medium/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: PaddleOCR
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
pipeline_tag: image-to-text
|
| 8 |
+
tags:
|
| 9 |
+
- OCR
|
| 10 |
+
- PaddlePaddle
|
| 11 |
+
- PaddleOCR
|
| 12 |
+
- textline_detection
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
<div align="center">
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
<h1 align="center">
|
| 19 |
+
|
| 20 |
+
PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks
|
| 21 |
+
|
| 22 |
+
</h1>
|
| 23 |
+
|
| 24 |
+
[](https://github.com/PaddlePaddle/PaddleOCR)
|
| 25 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_det_safetensors)
|
| 26 |
+
[](https://x.com/PaddlePaddle)
|
| 27 |
+
[](./LICENSE)
|
| 28 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_det)
|
| 29 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_medium_det_onnx)
|
| 30 |
+
|
| 31 |
+
**🔥 [Official Website](https://www.paddleocr.com)**
|
| 32 |
+
**📝 [Technical Report](https://arxiv.org/pdf/2606.13108)**
|
| 33 |
+
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div align="center">
|
| 37 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/0XIrg0UmmOvplnPjmsmK3.png" width="800"/>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
## PP-OCRv6 Overview
|
| 41 |
+
|
| 42 |
+
PP-OCRv6 is a lightweight OCR system that combines architectural innovation with data-centric optimization. It redesigns the backbone, detection neck, and recognition neck around a unified MetaFormer-style building block with structural reparameterization. Three model tiers (medium, small, tiny) share the same block primitives, covering deployment scenarios from server to edge.
|
| 43 |
+
|
| 44 |
+
### Key Features
|
| 45 |
+
|
| 46 |
+
1. **Unified and Scalable Model Family:** A three-tier OCR model family spanning 1.5M to 34.5M parameters. PP-OCRv6_medium achieves 86.2% detection Hmean and 83.2% recognition accuracy, outperforming PP-OCRv5_server by +4.6% and +5.1% respectively.
|
| 47 |
+
|
| 48 |
+
2. **Lightweight Architectural Innovations:** (i) LCNetV4, a MetaFormer-style lightweight backbone with structural reparameterization; (ii) RepLKFPN, a detection neck with dilated reparameterizable depthwise convolutions; (iii) EncoderWithLightSVTR, a recognition neck with local-global attention and additive skip connections.
|
| 49 |
+
|
| 50 |
+
3. **Multi-Language and Scenario Support:** Supports 48 languages and diverse industrial scenes (digital displays, dot-matrix characters, tire prints, etc.), surpassing Qwen3-VL-235B, GPT-5.5, and Gemini-3.1-Pro with orders of magnitude fewer parameters.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# PP-OCRv6_medium_det
|
| 54 |
+
|
| 55 |
+
## Introduction
|
| 56 |
+
|
| 57 |
+
<div align="center">
|
| 58 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/ofnSGExgJL6K6d8ghh0vl.png" width="600"/>
|
| 59 |
+
|
| 60 |
+
PP-OCRv6 text detection architecture overview
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
PP-OCRv6_medium_det is the largest model in the PP-OCRv6 detection series developed by the PaddleOCR team. It uses LCNetV4 as the backbone and RepLKFPN as the feature pyramid neck, providing accurate text localization across diverse scenarios including handwritten, printed, rotated, curved, and artistic text in multiple languages. The model contains 15.5M parameters. The key accuracy metrics are as follows:
|
| 64 |
+
|
| 65 |
+
| Model | Average | Handwritten CN | Handwritten EN | Printed CN | Printed EN | Traditional Chinese | Ancient Text | Japanese | Blur | Emoji | Warp | Pinyin | Artistic | Table | Rotation | Industrial | General |
|
| 66 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 67 |
+
| Gemini-3.1-Pro | 46.8 | 53.4 | 56.5 | 47.3 | 47.6 | 39.0 | 45.8 | 38.2 | 50.0 | 68.1 | 44.6 | 40.6 | 65.2 | 26.9 | 22.1 | 52.5 | 50.2 |
|
| 68 |
+
| GPT-5.5 | 45.6 | 42.4 | 58.5 | 50.2 | 51.9 | 35.0 | 26.7 | 42.0 | 49.1 | 97.5 | 37.7 | 36.3 | 52.0 | 71.0 | 10.0 | 36.2 | 32.6 |
|
| 69 |
+
| Qwen3-VL-235B | 38.3 | 56.5 | 66.0 | 41.7 | 37.0 | 19.3 | 13.1 | 27.0 | 38.5 | 81.2 | 28.5 | 33.0 | 68.3 | 19.6 | 2.1 | 48.4 | 32.3 |
|
| 70 |
+
| Kimi-K2.6 | 12.8 | 12.5 | 25.5 | 10.1 | 18.5 | 8.2 | 7.5 | 11.2 | 16.9 | 28.9 | 13.9 | 6.8 | 16.1 | 10.9 | 0.8 | 6.3 | 10.9 |
|
| 71 |
+
| MiniMax-M3 | 12.0 | 13.7 | 19.3 | 9.8 | 14.1 | 7.7 | 11.1 | 10.6 | 16.1 | 32.8 | 12.8 | 8.5 | 16.6 | 5.5 | 0.1 | 6.4 | 6.4 |
|
| 72 |
+
| PP-OCRv5_server | 81.6 | 80.3 | 84.1 | 94.5 | 91.7 | 81.5 | 67.6 | 77.2 | 90.1 | 96.2 | 87.6 | 67.1 | 67.3 | 97.1 | 80.0 | 64.3 | 79.7 |
|
| 73 |
+
| PP-OCRv5_mobile | 75.2 | 74.4 | 77.7 | 90.5 | 91.0 | 82.3 | 58.1 | 72.7 | 87.4 | 93.6 | 82.7 | 57.5 | 52.5 | 92.8 | 64.7 | 52.8 | 72.1 |
|
| 74 |
+
| **PP-OCRv6_medium** | **86.2** | **83.7** | **84.0** | **95.1** | **93.7** | **86.3** | **80.2** | **84.3** | **94.1** | **99.6** | **88.6** | **74.0** | **69.0** | **96.8** | **93.8** | **73.3** | **82.8** |
|
| 75 |
+
| PP-OCRv6_small | 84.1 | 80.5 | 87.1 | 94.2 | 93.6 | 85.7 | 72.6 | 82.3 | 92.6 | 99.7 | 87.6 | 69.6 | 65.3 | 95.6 | 93.7 | 67.6 | 78.2 |
|
| 76 |
+
| PP-OCRv6_tiny | 80.6 | 79.4 | 85.9 | 93.1 | 92.3 | 83.7 | 63.0 | 76.6 | 89.3 | 99.8 | 86.1 | 59.0 | 60.1 | 94.7 | 91.0 | 62.0 | 73.8 |
|
| 77 |
+
|
| 78 |
+
## Quick Start
|
| 79 |
+
|
| 80 |
+
### Installation
|
| 81 |
+
|
| 82 |
+
1. PaddleOCR
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
# Install the basic version
|
| 86 |
+
pip install paddleocr
|
| 87 |
+
|
| 88 |
+
# Install the full version (includes all features)
|
| 89 |
+
pip install "paddleocr[all]"
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
2. Transformers environment (required for safetensors models)
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
pip install transformers torch
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Model Usage
|
| 99 |
+
|
| 100 |
+
You can quickly experience the functionality with a single command:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
paddleocr text_detection \
|
| 104 |
+
--model_name PP-OCRv6_medium_det \
|
| 105 |
+
--engine transformers \
|
| 106 |
+
-i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the sample image to your local machine.
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
from paddleocr import TextDetection
|
| 113 |
+
model = TextDetection(model_name="PP-OCRv6_medium_det", engine="transformers")
|
| 114 |
+
output = model.predict(input="3ul2Rq4Sk5Cn-l69D695U.png", batch_size=1)
|
| 115 |
+
for res in output:
|
| 116 |
+
res.print()
|
| 117 |
+
res.save_to_img(save_path="./output/")
|
| 118 |
+
res.save_to_json(save_path="./output/res.json")
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 122 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/module_usage/text_detection.html#iii-quick-start).
|
| 123 |
+
|
| 124 |
+
### Pipeline Usage
|
| 125 |
+
|
| 126 |
+
The general OCR pipeline extracts text information from images. The pipeline consists of several modules:
|
| 127 |
+
* Document Image Orientation Classification Module (Optional)
|
| 128 |
+
* Text Image Unwarping Module (Optional)
|
| 129 |
+
* Text Line Orientation Classification Module (Optional)
|
| 130 |
+
* Text Detection Module
|
| 131 |
+
* Text Recognition Module
|
| 132 |
+
|
| 133 |
+
Run a single command to quickly experience the OCR pipeline:
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
paddleocr ocr -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png \
|
| 137 |
+
--text_detection_model_name PP-OCRv6_medium_det \
|
| 138 |
+
--text_recognition_model_name PP-OCRv6_medium_rec \
|
| 139 |
+
--engine transformers \
|
| 140 |
+
--use_doc_orientation_classify False \
|
| 141 |
+
--use_doc_unwarping False \
|
| 142 |
+
--use_textline_orientation True \
|
| 143 |
+
--save_path ./output \
|
| 144 |
+
--device gpu:0
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
For project integration:
|
| 148 |
+
|
| 149 |
+
```python
|
| 150 |
+
from paddleocr import PaddleOCR
|
| 151 |
+
|
| 152 |
+
ocr = PaddleOCR(
|
| 153 |
+
text_detection_model_name="PP-OCRv6_medium_det",
|
| 154 |
+
text_recognition_model_name="PP-OCRv6_medium_rec",
|
| 155 |
+
engine="transformers",
|
| 156 |
+
use_doc_orientation_classify=False,
|
| 157 |
+
use_doc_unwarping=False,
|
| 158 |
+
use_textline_orientation=False,
|
| 159 |
+
)
|
| 160 |
+
result = ocr.predict("./3ul2Rq4Sk5Cn-l69D695U.png")
|
| 161 |
+
for res in result:
|
| 162 |
+
res.print()
|
| 163 |
+
res.save_to_img("output")
|
| 164 |
+
res.save_to_json("output")
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 168 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/pipeline_usage/OCR.html#2-quick-start).
|
| 169 |
+
|
| 170 |
+
## Links
|
| 171 |
+
|
| 172 |
+
[PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
|
| 173 |
+
|
| 174 |
+
[PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)
|
| 175 |
+
|
| 176 |
+
## Citation
|
| 177 |
+
|
| 178 |
+
```bibtex
|
| 179 |
+
@misc{zhang2026ppocrv6,
|
| 180 |
+
title={PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks},
|
| 181 |
+
author={Yubo Zhang and Xueqing Wang and Manhui Lin and Yue Zhang and Penglongyi Deng and Ting Sun and Tingquan Gao and Zelun Zhang and Jiaxuan Liu and Changda Zhou and Hongen Liu and Suyin Liang and Cheng Cui and Yi Liu and Dianhai Yu and Yanjun Ma},
|
| 182 |
+
year={2026},
|
| 183 |
+
eprint={2606.13108},
|
| 184 |
+
archivePrefix={arXiv},
|
| 185 |
+
primaryClass={cs.CV},
|
| 186 |
+
url={https://arxiv.org/abs/2606.13108},
|
| 187 |
+
}
|
| 188 |
+
```
|
det_v6_medium/config.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv6_medium_det",
|
| 3 |
+
"mode": "large",
|
| 4 |
+
"upsample_mode": "nearest",
|
| 5 |
+
"upsample_align_mode": 1,
|
| 6 |
+
"backbone_config": {
|
| 7 |
+
"model_type": "pp_lcnet_v4",
|
| 8 |
+
"stem_channels": [3, 64, 128],
|
| 9 |
+
"stem_type": "large",
|
| 10 |
+
"out_features": ["stage1", "stage2", "stage3", "stage4"],
|
| 11 |
+
"out_indices": [1, 2, 3, 4],
|
| 12 |
+
"block_configs": [
|
| 13 |
+
[[3, 128, 128, 1, true], [3, 128, 128, 1, false]],
|
| 14 |
+
[
|
| 15 |
+
[3, 128, 256, 2, false],
|
| 16 |
+
[3, 256, 256, 1, true],
|
| 17 |
+
[3, 256, 256, 1, false]
|
| 18 |
+
],
|
| 19 |
+
[
|
| 20 |
+
[3, 256, 512, 2, false],
|
| 21 |
+
[3, 512, 512, 1, true],
|
| 22 |
+
[3, 512, 512, 1, false],
|
| 23 |
+
[3, 512, 512, 1, true],
|
| 24 |
+
[3, 512, 512, 1, false]
|
| 25 |
+
],
|
| 26 |
+
[
|
| 27 |
+
[3, 512, 896, 2, false],
|
| 28 |
+
[3, 896, 896, 1, true],
|
| 29 |
+
[3, 896, 896, 1, false]
|
| 30 |
+
]
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
"use_lab": false,
|
| 34 |
+
"use_last_conv": true,
|
| 35 |
+
"class_expand": 2048,
|
| 36 |
+
"class_num": 1000,
|
| 37 |
+
"out_indices": [0, 1, 2, 3],
|
| 38 |
+
"neck_out_channels": 256,
|
| 39 |
+
"reduce_factor": 2,
|
| 40 |
+
"intraclass_block_number": 4,
|
| 41 |
+
"intraclass_block_config": {
|
| 42 |
+
"reduce_channel": [1, 1, 0],
|
| 43 |
+
"return_channel": [1, 1, 0],
|
| 44 |
+
"vertical_long_to_small_conv_longratio": [[7, 1], [1, 1], [3, 0]],
|
| 45 |
+
"vertical_long_to_small_conv_midratio": [[5, 1], [1, 1], [2, 0]],
|
| 46 |
+
"vertical_long_to_small_conv_shortratio": [[3, 1], [1, 1], [1, 0]],
|
| 47 |
+
"horizontal_small_to_long_conv_longratio": [[1, 7], [1, 1], [0, 3]],
|
| 48 |
+
"horizontal_small_to_long_conv_midratio": [[1, 5], [1, 1], [0, 2]],
|
| 49 |
+
"horizontal_small_to_long_conv_shortratio": [[1, 3], [1, 1], [0, 1]],
|
| 50 |
+
"symmetric_conv_long_longratio": [[7, 7], [1, 1], [3, 3]],
|
| 51 |
+
"symmetric_conv_long_midratio": [[5, 5], [1, 1], [2, 2]],
|
| 52 |
+
"symmetric_conv_long_shortratio": [[3, 3], [1, 1], [1, 1]]
|
| 53 |
+
},
|
| 54 |
+
"head_in_channels": 1024,
|
| 55 |
+
"scale_factor": 2,
|
| 56 |
+
"scale_factor_list": [1, 2, 4, 8],
|
| 57 |
+
"hidden_act": "relu",
|
| 58 |
+
"kernel_list": [3, 2, 2]
|
| 59 |
+
}
|
det_v6_medium/inference.yml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_medium_det
|
| 3 |
+
Hpi:
|
| 4 |
+
backend_configs:
|
| 5 |
+
paddle_infer:
|
| 6 |
+
trt_dynamic_shapes: &id001
|
| 7 |
+
x:
|
| 8 |
+
- - 1
|
| 9 |
+
- 3
|
| 10 |
+
- 32
|
| 11 |
+
- 32
|
| 12 |
+
- - 1
|
| 13 |
+
- 3
|
| 14 |
+
- 736
|
| 15 |
+
- 736
|
| 16 |
+
- - 1
|
| 17 |
+
- 3
|
| 18 |
+
- 4000
|
| 19 |
+
- 4000
|
| 20 |
+
tensorrt:
|
| 21 |
+
dynamic_shapes: *id001
|
| 22 |
+
PostProcess:
|
| 23 |
+
box_thresh: 0.45
|
| 24 |
+
max_candidates: 3000
|
| 25 |
+
name: DBPostProcess
|
| 26 |
+
thresh: 0.2
|
| 27 |
+
unclip_ratio: 1.4
|
| 28 |
+
PreProcess:
|
| 29 |
+
transform_ops:
|
| 30 |
+
- DecodeImage:
|
| 31 |
+
channel_first: false
|
| 32 |
+
img_mode: BGR
|
| 33 |
+
- DetLabelEncode: null
|
| 34 |
+
- DetResizeForTest: null
|
| 35 |
+
- NormalizeImage:
|
| 36 |
+
mean:
|
| 37 |
+
- 0.485
|
| 38 |
+
- 0.456
|
| 39 |
+
- 0.406
|
| 40 |
+
order: hwc
|
| 41 |
+
scale: 1./255.
|
| 42 |
+
std:
|
| 43 |
+
- 0.229
|
| 44 |
+
- 0.224
|
| 45 |
+
- 0.225
|
| 46 |
+
- ToCHWImage: null
|
| 47 |
+
- KeepKeys:
|
| 48 |
+
keep_keys:
|
| 49 |
+
- image
|
| 50 |
+
- shape
|
| 51 |
+
- polys
|
| 52 |
+
- ignore_tags
|
det_v6_medium/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:092c940c880497005aa38c2d9cd3ba0a5642924b086f676ca9a2e740d25b695e
|
| 3 |
+
size 88020395
|
det_v6_medium/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd393266c02e1a680b1b34c301d5d0d81e6290440b7f8ab0f5d5032276b17eb1
|
| 3 |
+
size 88020412
|
det_v6_medium/preprocessor_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_valid_processor_keys": [
|
| 3 |
+
"images",
|
| 4 |
+
"do_resize",
|
| 5 |
+
"size",
|
| 6 |
+
"resample",
|
| 7 |
+
"do_rescale",
|
| 8 |
+
"rescale_factor",
|
| 9 |
+
"do_normalize",
|
| 10 |
+
"image_mean",
|
| 11 |
+
"image_std",
|
| 12 |
+
"return_tensors",
|
| 13 |
+
"data_format",
|
| 14 |
+
"input_data_format"
|
| 15 |
+
],
|
| 16 |
+
"do_convert_rgb": true,
|
| 17 |
+
"do_normalize": true,
|
| 18 |
+
"do_rescale": true,
|
| 19 |
+
"do_resize": true,
|
| 20 |
+
"image_processor_type": "PPOCRV5ServerDetImageProcessor",
|
| 21 |
+
"model_input_names": ["pixel_values", "original_image_size"],
|
| 22 |
+
"image_mode": "BGR",
|
| 23 |
+
"channel_first": false,
|
| 24 |
+
"limit_side_len": 736,
|
| 25 |
+
"limit_type": "min",
|
| 26 |
+
"max_side_limit": 4000,
|
| 27 |
+
"image_mean": [0.406, 0.456, 0.485],
|
| 28 |
+
"image_std": [0.225, 0.224, 0.229],
|
| 29 |
+
"rescale_factor": 0.00392156862745098,
|
| 30 |
+
"resample": 2,
|
| 31 |
+
"normalize_order": "hwc",
|
| 32 |
+
"do_to_chw": true,
|
| 33 |
+
"keep_keys": ["image", "shape", "polys", "ignore_tags"]
|
| 34 |
+
}
|
det_v6_small/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
det_v6_small/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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CR
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
pipeline_tag: image-to-text
|
| 8 |
+
tags:
|
| 9 |
+
- OCR
|
| 10 |
+
- PaddlePaddle
|
| 11 |
+
- PaddleOCR
|
| 12 |
+
- textline_detection
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
<div align="center">
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
<h1 align="center">
|
| 19 |
+
|
| 20 |
+
PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks
|
| 21 |
+
|
| 22 |
+
</h1>
|
| 23 |
+
|
| 24 |
+
[](https://github.com/PaddlePaddle/PaddleOCR)
|
| 25 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_det_safetensors)
|
| 26 |
+
[](https://x.com/PaddlePaddle)
|
| 27 |
+
[](./LICENSE)
|
| 28 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_det)
|
| 29 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_small_det_onnx)
|
| 30 |
+
|
| 31 |
+
**🔥 [Official Website](https://www.paddleocr.com)**
|
| 32 |
+
**📝 [Technical Report](https://arxiv.org/pdf/2606.13108)**
|
| 33 |
+
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div align="center">
|
| 37 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/0XIrg0UmmOvplnPjmsmK3.png" width="800"/>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
## PP-OCRv6 Overview
|
| 41 |
+
|
| 42 |
+
PP-OCRv6 is a lightweight OCR system that combines architectural innovation with data-centric optimization. It redesigns the backbone, detection neck, and recognition neck around a unified MetaFormer-style building block with structural reparameterization. Three model tiers (medium, small, tiny) share the same block primitives, covering deployment scenarios from server to edge.
|
| 43 |
+
|
| 44 |
+
### Key Features
|
| 45 |
+
|
| 46 |
+
1. **Unified and Scalable Model Family:** A three-tier OCR model family spanning 1.5M to 34.5M parameters. PP-OCRv6_medium achieves 86.2% detection Hmean and 83.2% recognition accuracy, outperforming PP-OCRv5_server by +4.6% and +5.1% respectively.
|
| 47 |
+
|
| 48 |
+
2. **Lightweight Architectural Innovations:** (i) LCNetV4, a MetaFormer-style lightweight backbone with structural reparameterization; (ii) RepLKFPN, a detection neck with dilated reparameterizable depthwise convolutions; (iii) EncoderWithLightSVTR, a recognition neck with local-global attention and additive skip connections.
|
| 49 |
+
|
| 50 |
+
3. **Multi-Language and Scenario Support:** Supports 48 languages and diverse industrial scenes (digital displays, dot-matrix characters, tire prints, etc.), surpassing Qwen3-VL-235B, GPT-5.5, and Gemini-3.1-Pro with orders of magnitude fewer parameters.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# PP-OCRv6_small_det
|
| 54 |
+
|
| 55 |
+
## Introduction
|
| 56 |
+
|
| 57 |
+
<div align="center">
|
| 58 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/ofnSGExgJL6K6d8ghh0vl.png" width="600"/>
|
| 59 |
+
|
| 60 |
+
PP-OCRv6 text detection architecture overview
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
PP-OCRv6_small_det is the small model in the PP-OCRv6 detection series developed by the PaddleOCR team. It uses LCNetV4 as the backbone and RepLKFPN as the feature pyramid neck, providing accurate text localization across diverse scenarios including handwritten, printed, rotated, curved, and artistic text in multiple languages. The model contains 2.48M parameters. The key accuracy metrics are as follows:
|
| 64 |
+
|
| 65 |
+
| Model | Average | Handwritten CN | Handwritten EN | Printed CN | Printed EN | Traditional Chinese | Ancient Text | Japanese | Blur | Emoji | Warp | Pinyin | Artistic | Table | Rotation | Industrial | General |
|
| 66 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 67 |
+
| Gemini-3.1-Pro | 46.8 | 53.4 | 56.5 | 47.3 | 47.6 | 39.0 | 45.8 | 38.2 | 50.0 | 68.1 | 44.6 | 40.6 | 65.2 | 26.9 | 22.1 | 52.5 | 50.2 |
|
| 68 |
+
| GPT-5.5 | 45.6 | 42.4 | 58.5 | 50.2 | 51.9 | 35.0 | 26.7 | 42.0 | 49.1 | 97.5 | 37.7 | 36.3 | 52.0 | 71.0 | 10.0 | 36.2 | 32.6 |
|
| 69 |
+
| Qwen3-VL-235B | 38.3 | 56.5 | 66.0 | 41.7 | 37.0 | 19.3 | 13.1 | 27.0 | 38.5 | 81.2 | 28.5 | 33.0 | 68.3 | 19.6 | 2.1 | 48.4 | 32.3 |
|
| 70 |
+
| Kimi-K2.6 | 12.8 | 12.5 | 25.5 | 10.1 | 18.5 | 8.2 | 7.5 | 11.2 | 16.9 | 28.9 | 13.9 | 6.8 | 16.1 | 10.9 | 0.8 | 6.3 | 10.9 |
|
| 71 |
+
| MiniMax-M3 | 12.0 | 13.7 | 19.3 | 9.8 | 14.1 | 7.7 | 11.1 | 10.6 | 16.1 | 32.8 | 12.8 | 8.5 | 16.6 | 5.5 | 0.1 | 6.4 | 6.4 |
|
| 72 |
+
| PP-OCRv5_server | 81.6 | 80.3 | 84.1 | 94.5 | 91.7 | 81.5 | 67.6 | 77.2 | 90.1 | 96.2 | 87.6 | 67.1 | 67.3 | 97.1 | 80.0 | 64.3 | 79.7 |
|
| 73 |
+
| PP-OCRv5_mobile | 75.2 | 74.4 | 77.7 | 90.5 | 91.0 | 82.3 | 58.1 | 72.7 | 87.4 | 93.6 | 82.7 | 57.5 | 52.5 | 92.8 | 64.7 | 52.8 | 72.1 |
|
| 74 |
+
| PP-OCRv6_medium | 86.2 | 83.7 | 84.0 | 95.1 | 93.7 | 86.3 | 80.2 | 84.3 | 94.1 | 99.6 | 88.6 | 74.0 | 69.0 | 96.8 | 93.8 | 73.3 | 82.8 |
|
| 75 |
+
| **PP-OCRv6_small** | **84.1** | **80.5** | **87.1** | **94.2** | **93.6** | **85.7** | **72.6** | **82.3** | **92.6** | **99.7** | **87.6** | **69.6** | **65.3** | **95.6** | **93.7** | **67.6** | **78.2** |
|
| 76 |
+
| PP-OCRv6_tiny | 80.6 | 79.4 | 85.9 | 93.1 | 92.3 | 83.7 | 63.0 | 76.6 | 89.3 | 99.8 | 86.1 | 59.0 | 60.1 | 94.7 | 91.0 | 62.0 | 73.8 |
|
| 77 |
+
|
| 78 |
+
## Quick Start
|
| 79 |
+
|
| 80 |
+
### Installation
|
| 81 |
+
|
| 82 |
+
1. PaddleOCR
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
# Install the basic version
|
| 86 |
+
pip install paddleocr
|
| 87 |
+
|
| 88 |
+
# Install the full version (includes all features)
|
| 89 |
+
pip install "paddleocr[all]"
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
2. Transformers environment (required for safetensors models)
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
pip install transformers torch
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Model Usage
|
| 99 |
+
|
| 100 |
+
You can quickly experience the functionality with a single command:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
paddleocr text_detection \
|
| 104 |
+
--model_name PP-OCRv6_small_det \
|
| 105 |
+
--engine transformers \
|
| 106 |
+
-i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the sample image to your local machine.
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
from paddleocr import TextDetection
|
| 113 |
+
model = TextDetection(model_name="PP-OCRv6_small_det", engine="transformers")
|
| 114 |
+
output = model.predict(input="3ul2Rq4Sk5Cn-l69D695U.png", batch_size=1)
|
| 115 |
+
for res in output:
|
| 116 |
+
res.print()
|
| 117 |
+
res.save_to_img(save_path="./output/")
|
| 118 |
+
res.save_to_json(save_path="./output/res.json")
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 122 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/module_usage/text_detection.html#iii-quick-start).
|
| 123 |
+
|
| 124 |
+
### Pipeline Usage
|
| 125 |
+
|
| 126 |
+
The general OCR pipeline extracts text information from images. The pipeline consists of several modules:
|
| 127 |
+
* Document Image Orientation Classification Module (Optional)
|
| 128 |
+
* Text Image Unwarping Module (Optional)
|
| 129 |
+
* Text Line Orientation Classification Module (Optional)
|
| 130 |
+
* Text Detection Module
|
| 131 |
+
* Text Recognition Module
|
| 132 |
+
|
| 133 |
+
Run a single command to quickly experience the OCR pipeline:
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
paddleocr ocr -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png \
|
| 137 |
+
--text_detection_model_name PP-OCRv6_small_det \
|
| 138 |
+
--text_recognition_model_name PP-OCRv6_small_rec \
|
| 139 |
+
--engine transformers \
|
| 140 |
+
--use_doc_orientation_classify False \
|
| 141 |
+
--use_doc_unwarping False \
|
| 142 |
+
--use_textline_orientation True \
|
| 143 |
+
--save_path ./output \
|
| 144 |
+
--device gpu:0
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
For project integration:
|
| 148 |
+
|
| 149 |
+
```python
|
| 150 |
+
from paddleocr import PaddleOCR
|
| 151 |
+
|
| 152 |
+
ocr = PaddleOCR(
|
| 153 |
+
text_detection_model_name="PP-OCRv6_small_det",
|
| 154 |
+
text_recognition_model_name="PP-OCRv6_small_rec",
|
| 155 |
+
engine="transformers",
|
| 156 |
+
use_doc_orientation_classify=False,
|
| 157 |
+
use_doc_unwarping=False,
|
| 158 |
+
use_textline_orientation=False,
|
| 159 |
+
)
|
| 160 |
+
result = ocr.predict("./3ul2Rq4Sk5Cn-l69D695U.png")
|
| 161 |
+
for res in result:
|
| 162 |
+
res.print()
|
| 163 |
+
res.save_to_img("output")
|
| 164 |
+
res.save_to_json("output")
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 168 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/pipeline_usage/OCR.html#2-quick-start).
|
| 169 |
+
|
| 170 |
+
## Links
|
| 171 |
+
|
| 172 |
+
[PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
|
| 173 |
+
|
| 174 |
+
[PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)
|
| 175 |
+
|
| 176 |
+
## Citation
|
| 177 |
+
|
| 178 |
+
```bibtex
|
| 179 |
+
@misc{zhang2026ppocrv6,
|
| 180 |
+
title={PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks},
|
| 181 |
+
author={Yubo Zhang and Xueqing Wang and Manhui Lin and Yue Zhang and Penglongyi Deng and Ting Sun and Tingquan Gao and Zelun Zhang and Jiaxuan Liu and Changda Zhou and Hongen Liu and Suyin Liang and Cheng Cui and Yi Liu and Dianhai Yu and Yanjun Ma},
|
| 182 |
+
year={2026},
|
| 183 |
+
eprint={2606.13108},
|
| 184 |
+
archivePrefix={arXiv},
|
| 185 |
+
primaryClass={cs.CV},
|
| 186 |
+
url={https://arxiv.org/abs/2606.13108},
|
| 187 |
+
}
|
| 188 |
+
```
|
det_v6_small/config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv6_small_det",
|
| 3 |
+
"reduction": 4,
|
| 4 |
+
"layer_list_out_channels": [48, 96, 192, 384],
|
| 5 |
+
"neck_out_channels": 96,
|
| 6 |
+
"kernel_list": [3, 2, 2],
|
| 7 |
+
"interpolate_mode": "nearest",
|
| 8 |
+
"dilated_kernel_size": 7,
|
| 9 |
+
"backbone_config": {
|
| 10 |
+
"model_type": "pp_lcnet_v4",
|
| 11 |
+
"stem_channels": [3, 24, 48],
|
| 12 |
+
"stem_type": "large",
|
| 13 |
+
"out_features": ["stage1", "stage2", "stage3", "stage4"],
|
| 14 |
+
"out_indices": [1, 2, 3, 4],
|
| 15 |
+
"block_configs": [
|
| 16 |
+
[[3, 48, 48, 1, true], [3, 48, 48, 1, false]],
|
| 17 |
+
[
|
| 18 |
+
[3, 48, 96, 2, false],
|
| 19 |
+
[3, 96, 96, 1, true],
|
| 20 |
+
[3, 96, 96, 1, false]
|
| 21 |
+
],
|
| 22 |
+
[
|
| 23 |
+
[3, 96, 192, 2, false],
|
| 24 |
+
[3, 192, 192, 1, true],
|
| 25 |
+
[3, 192, 192, 1, false],
|
| 26 |
+
[3, 192, 192, 1, true],
|
| 27 |
+
[3, 192, 192, 1, false]
|
| 28 |
+
],
|
| 29 |
+
[
|
| 30 |
+
[3, 192, 384, 2, false],
|
| 31 |
+
[3, 384, 384, 1, true],
|
| 32 |
+
[3, 384, 384, 1, false]
|
| 33 |
+
]
|
| 34 |
+
]
|
| 35 |
+
}
|
| 36 |
+
}
|
det_v6_small/inference.yml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_small_det
|
| 3 |
+
Hpi:
|
| 4 |
+
backend_configs:
|
| 5 |
+
paddle_infer:
|
| 6 |
+
trt_dynamic_shapes: &id001
|
| 7 |
+
x:
|
| 8 |
+
- - 1
|
| 9 |
+
- 3
|
| 10 |
+
- 32
|
| 11 |
+
- 32
|
| 12 |
+
- - 1
|
| 13 |
+
- 3
|
| 14 |
+
- 736
|
| 15 |
+
- 736
|
| 16 |
+
- - 1
|
| 17 |
+
- 3
|
| 18 |
+
- 4000
|
| 19 |
+
- 4000
|
| 20 |
+
tensorrt:
|
| 21 |
+
dynamic_shapes: *id001
|
| 22 |
+
PostProcess:
|
| 23 |
+
box_thresh: 0.45
|
| 24 |
+
max_candidates: 3000
|
| 25 |
+
name: DBPostProcess
|
| 26 |
+
thresh: 0.2
|
| 27 |
+
unclip_ratio: 1.4
|
| 28 |
+
PreProcess:
|
| 29 |
+
transform_ops:
|
| 30 |
+
- DecodeImage:
|
| 31 |
+
channel_first: false
|
| 32 |
+
img_mode: BGR
|
| 33 |
+
- DetLabelEncode: null
|
| 34 |
+
- DetResizeForTest: null
|
| 35 |
+
- NormalizeImage:
|
| 36 |
+
mean:
|
| 37 |
+
- 0.485
|
| 38 |
+
- 0.456
|
| 39 |
+
- 0.406
|
| 40 |
+
order: hwc
|
| 41 |
+
scale: 1./255.
|
| 42 |
+
std:
|
| 43 |
+
- 0.229
|
| 44 |
+
- 0.224
|
| 45 |
+
- 0.225
|
| 46 |
+
- ToCHWImage: null
|
| 47 |
+
- KeepKeys:
|
| 48 |
+
keep_keys:
|
| 49 |
+
- image
|
| 50 |
+
- shape
|
| 51 |
+
- polys
|
| 52 |
+
- ignore_tags
|
det_v6_small/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d5df635685117b596dd2f73343ada1eb935488f91377c1b49489c93df15ee849
|
| 3 |
+
size 9938180
|
det_v6_small/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:89a96a8adc4e9cd0c994098edc76022e496d35844392562b4694c8fbc583f2da
|
| 3 |
+
size 9938124
|
det_v6_small/preprocessor_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_valid_processor_keys": [
|
| 3 |
+
"images",
|
| 4 |
+
"do_resize",
|
| 5 |
+
"size",
|
| 6 |
+
"resample",
|
| 7 |
+
"do_rescale",
|
| 8 |
+
"rescale_factor",
|
| 9 |
+
"do_normalize",
|
| 10 |
+
"image_mean",
|
| 11 |
+
"image_std",
|
| 12 |
+
"return_tensors",
|
| 13 |
+
"data_format",
|
| 14 |
+
"input_data_format"
|
| 15 |
+
],
|
| 16 |
+
"do_convert_rgb": true,
|
| 17 |
+
"do_normalize": true,
|
| 18 |
+
"do_rescale": true,
|
| 19 |
+
"do_resize": true,
|
| 20 |
+
"image_processor_type": "PPOCRV5ServerDetImageProcessor",
|
| 21 |
+
"model_input_names": ["pixel_values", "original_image_size"],
|
| 22 |
+
"image_mode": "BGR",
|
| 23 |
+
"channel_first": false,
|
| 24 |
+
"limit_side_len": 736,
|
| 25 |
+
"limit_type": "min",
|
| 26 |
+
"max_side_limit": 4000,
|
| 27 |
+
"image_mean": [0.406, 0.456, 0.485],
|
| 28 |
+
"image_std": [0.225, 0.224, 0.229],
|
| 29 |
+
"rescale_factor": 0.00392156862745098,
|
| 30 |
+
"resample": 2,
|
| 31 |
+
"normalize_order": "hwc",
|
| 32 |
+
"do_to_chw": true,
|
| 33 |
+
"keep_keys": ["image", "shape", "polys", "ignore_tags"]
|
| 34 |
+
}
|
det_v6_tiny/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
det_v6_tiny/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
- zh
|
| 7 |
+
pipeline_tag: image-to-text
|
| 8 |
+
tags:
|
| 9 |
+
- OCR
|
| 10 |
+
- PaddlePaddle
|
| 11 |
+
- PaddleOCR
|
| 12 |
+
- textline_detection
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
<div align="center">
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
<h1 align="center">
|
| 19 |
+
|
| 20 |
+
PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks
|
| 21 |
+
|
| 22 |
+
</h1>
|
| 23 |
+
|
| 24 |
+
[](https://github.com/PaddlePaddle/PaddleOCR)
|
| 25 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_tiny_det_safetensors)
|
| 26 |
+
[](https://x.com/PaddlePaddle)
|
| 27 |
+
[](./LICENSE)
|
| 28 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_tiny_det)
|
| 29 |
+
[](https://huggingface.co/PaddlePaddle/PP-OCRv6_tiny_det_onnx)
|
| 30 |
+
|
| 31 |
+
**🔥 [Official Website](https://www.paddleocr.com)**
|
| 32 |
+
**📝 [Technical Report](https://arxiv.org/pdf/2606.13108)**
|
| 33 |
+
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<div align="center">
|
| 37 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/0XIrg0UmmOvplnPjmsmK3.png" width="800"/>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
## PP-OCRv6 Overview
|
| 41 |
+
|
| 42 |
+
PP-OCRv6 is a lightweight OCR system that combines architectural innovation with data-centric optimization. It redesigns the backbone, detection neck, and recognition neck around a unified MetaFormer-style building block with structural reparameterization. Three model tiers (medium, small, tiny) share the same block primitives, covering deployment scenarios from server to edge.
|
| 43 |
+
|
| 44 |
+
### Key Features
|
| 45 |
+
|
| 46 |
+
1. **Unified and Scalable Model Family:** A three-tier OCR model family spanning 1.5M to 34.5M parameters. PP-OCRv6_medium achieves 86.2% detection Hmean and 83.2% recognition accuracy, outperforming PP-OCRv5_server by +4.6% and +5.1% respectively.
|
| 47 |
+
|
| 48 |
+
2. **Lightweight Architectural Innovations:** (i) LCNetV4, a MetaFormer-style lightweight backbone with structural reparameterization; (ii) RepLKFPN, a detection neck with dilated reparameterizable depthwise convolutions; (iii) EncoderWithLightSVTR, a recognition neck with local-global attention and additive skip connections.
|
| 49 |
+
|
| 50 |
+
3. **Multi-Language and Scenario Support:** Supports 48 languages and diverse industrial scenes (digital displays, dot-matrix characters, tire prints, etc.), surpassing Qwen3-VL-235B, GPT-5.5, and Gemini-3.1-Pro with orders of magnitude fewer parameters.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
# PP-OCRv6_tiny_det
|
| 54 |
+
|
| 55 |
+
## Introduction
|
| 56 |
+
|
| 57 |
+
<div align="center">
|
| 58 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/684ba591e717a30275a1b76a/ofnSGExgJL6K6d8ghh0vl.png" width="600"/>
|
| 59 |
+
|
| 60 |
+
PP-OCRv6 text detection architecture overview
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
PP-OCRv6_tiny_det is the tiny model in the PP-OCRv6 detection series developed by the PaddleOCR team. It uses LCNetV4 as the backbone and RepLKFPN as the feature pyramid neck, providing accurate text localization across diverse scenarios including handwritten, printed, rotated, curved, and artistic text in multiple languages. The model contains 0.43M parameters. The key accuracy metrics are as follows:
|
| 64 |
+
|
| 65 |
+
| Model | Average | Handwritten CN | Handwritten EN | Printed CN | Printed EN | Traditional Chinese | Ancient Text | Japanese | Blur | Emoji | Warp | Pinyin | Artistic | Table | Rotation | Industrial | General |
|
| 66 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 67 |
+
| Gemini-3.1-Pro | 46.8 | 53.4 | 56.5 | 47.3 | 47.6 | 39.0 | 45.8 | 38.2 | 50.0 | 68.1 | 44.6 | 40.6 | 65.2 | 26.9 | 22.1 | 52.5 | 50.2 |
|
| 68 |
+
| GPT-5.5 | 45.6 | 42.4 | 58.5 | 50.2 | 51.9 | 35.0 | 26.7 | 42.0 | 49.1 | 97.5 | 37.7 | 36.3 | 52.0 | 71.0 | 10.0 | 36.2 | 32.6 |
|
| 69 |
+
| Qwen3-VL-235B | 38.3 | 56.5 | 66.0 | 41.7 | 37.0 | 19.3 | 13.1 | 27.0 | 38.5 | 81.2 | 28.5 | 33.0 | 68.3 | 19.6 | 2.1 | 48.4 | 32.3 |
|
| 70 |
+
| Kimi-K2.6 | 12.8 | 12.5 | 25.5 | 10.1 | 18.5 | 8.2 | 7.5 | 11.2 | 16.9 | 28.9 | 13.9 | 6.8 | 16.1 | 10.9 | 0.8 | 6.3 | 10.9 |
|
| 71 |
+
| MiniMax-M3 | 12.0 | 13.7 | 19.3 | 9.8 | 14.1 | 7.7 | 11.1 | 10.6 | 16.1 | 32.8 | 12.8 | 8.5 | 16.6 | 5.5 | 0.1 | 6.4 | 6.4 |
|
| 72 |
+
| PP-OCRv5_server | 81.6 | 80.3 | 84.1 | 94.5 | 91.7 | 81.5 | 67.6 | 77.2 | 90.1 | 96.2 | 87.6 | 67.1 | 67.3 | 97.1 | 80.0 | 64.3 | 79.7 |
|
| 73 |
+
| PP-OCRv5_mobile | 75.2 | 74.4 | 77.7 | 90.5 | 91.0 | 82.3 | 58.1 | 72.7 | 87.4 | 93.6 | 82.7 | 57.5 | 52.5 | 92.8 | 64.7 | 52.8 | 72.1 |
|
| 74 |
+
| PP-OCRv6_medium | 86.2 | 83.7 | 84.0 | 95.1 | 93.7 | 86.3 | 80.2 | 84.3 | 94.1 | 99.6 | 88.6 | 74.0 | 69.0 | 96.8 | 93.8 | 73.3 | 82.8 |
|
| 75 |
+
| PP-OCRv6_small | 84.1 | 80.5 | 87.1 | 94.2 | 93.6 | 85.7 | 72.6 | 82.3 | 92.6 | 99.7 | 87.6 | 69.6 | 65.3 | 95.6 | 93.7 | 67.6 | 78.2 |
|
| 76 |
+
| **PP-OCRv6_tiny** | **80.6** | **79.4** | **85.9** | **93.1** | **92.3** | **83.7** | **63.0** | **76.6** | **89.3** | **99.8** | **86.1** | **59.0** | **60.1** | **94.7** | **91.0** | **62.0** | **73.8** |
|
| 77 |
+
|
| 78 |
+
## Quick Start
|
| 79 |
+
|
| 80 |
+
### Installation
|
| 81 |
+
|
| 82 |
+
1. PaddleOCR
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
# Install the basic version
|
| 86 |
+
pip install paddleocr
|
| 87 |
+
|
| 88 |
+
# Install the full version (includes all features)
|
| 89 |
+
pip install "paddleocr[all]"
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
2. Transformers environment (required for safetensors models)
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
pip install transformers torch
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Model Usage
|
| 99 |
+
|
| 100 |
+
You can quickly experience the functionality with a single command:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
paddleocr text_detection \
|
| 104 |
+
--model_name PP-OCRv6_tiny_det \
|
| 105 |
+
--engine transformers \
|
| 106 |
+
-i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
You can also integrate the model inference of the text detection module into your project. Before running the following code, please download the sample image to your local machine.
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
from paddleocr import TextDetection
|
| 113 |
+
model = TextDetection(model_name="PP-OCRv6_tiny_det", engine="transformers")
|
| 114 |
+
output = model.predict(input="3ul2Rq4Sk5Cn-l69D695U.png", batch_size=1)
|
| 115 |
+
for res in output:
|
| 116 |
+
res.print()
|
| 117 |
+
res.save_to_img(save_path="./output/")
|
| 118 |
+
res.save_to_json(save_path="./output/res.json")
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 122 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/module_usage/text_detection.html#iii-quick-start).
|
| 123 |
+
|
| 124 |
+
### Pipeline Usage
|
| 125 |
+
|
| 126 |
+
The general OCR pipeline extracts text information from images. The pipeline consists of several modules:
|
| 127 |
+
* Document Image Orientation Classification Module (Optional)
|
| 128 |
+
* Text Image Unwarping Module (Optional)
|
| 129 |
+
* Text Line Orientation Classification Module (Optional)
|
| 130 |
+
* Text Detection Module
|
| 131 |
+
* Text Recognition Module
|
| 132 |
+
|
| 133 |
+
Run a single command to quickly experience the OCR pipeline:
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
paddleocr ocr -i https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/3ul2Rq4Sk5Cn-l69D695U.png \
|
| 137 |
+
--text_detection_model_name PP-OCRv6_tiny_det \
|
| 138 |
+
--text_recognition_model_name PP-OCRv6_tiny_rec \
|
| 139 |
+
--engine transformers \
|
| 140 |
+
--use_doc_orientation_classify False \
|
| 141 |
+
--use_doc_unwarping False \
|
| 142 |
+
--use_textline_orientation True \
|
| 143 |
+
--save_path ./output \
|
| 144 |
+
--device gpu:0
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
For project integration:
|
| 148 |
+
|
| 149 |
+
```python
|
| 150 |
+
from paddleocr import PaddleOCR
|
| 151 |
+
|
| 152 |
+
ocr = PaddleOCR(
|
| 153 |
+
text_detection_model_name="PP-OCRv6_tiny_det",
|
| 154 |
+
text_recognition_model_name="PP-OCRv6_tiny_rec",
|
| 155 |
+
engine="transformers",
|
| 156 |
+
use_doc_orientation_classify=False,
|
| 157 |
+
use_doc_unwarping=False,
|
| 158 |
+
use_textline_orientation=False,
|
| 159 |
+
)
|
| 160 |
+
result = ocr.predict("./3ul2Rq4Sk5Cn-l69D695U.png")
|
| 161 |
+
for res in result:
|
| 162 |
+
res.print()
|
| 163 |
+
res.save_to_img("output")
|
| 164 |
+
res.save_to_json("output")
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
<!-- TODO: Update document links to PP-OCRv6 official documentation when available -->
|
| 168 |
+
For details about usage command and descriptions of parameters, please refer to the [Document](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/pipeline_usage/OCR.html#2-quick-start).
|
| 169 |
+
|
| 170 |
+
## Links
|
| 171 |
+
|
| 172 |
+
[PaddleOCR Repo](https://github.com/paddlepaddle/paddleocr)
|
| 173 |
+
|
| 174 |
+
[PaddleOCR Documentation](https://paddlepaddle.github.io/PaddleOCR/latest/en/index.html)
|
| 175 |
+
|
| 176 |
+
## Citation
|
| 177 |
+
|
| 178 |
+
```bibtex
|
| 179 |
+
@misc{zhang2026ppocrv6,
|
| 180 |
+
title={PP-OCRv6: From 1.5M to 34.5M Parameters, Surpassing Billion-Scale VLMs on OCR Tasks},
|
| 181 |
+
author={Yubo Zhang and Xueqing Wang and Manhui Lin and Yue Zhang and Penglongyi Deng and Ting Sun and Tingquan Gao and Zelun Zhang and Jiaxuan Liu and Changda Zhou and Hongen Liu and Suyin Liang and Cheng Cui and Yi Liu and Dianhai Yu and Yanjun Ma},
|
| 182 |
+
year={2026},
|
| 183 |
+
eprint={2606.13108},
|
| 184 |
+
archivePrefix={arXiv},
|
| 185 |
+
primaryClass={cs.CV},
|
| 186 |
+
url={https://arxiv.org/abs/2606.13108},
|
| 187 |
+
}
|
| 188 |
+
```
|
det_v6_tiny/config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv6_small_det",
|
| 3 |
+
"reduction": 4,
|
| 4 |
+
"layer_list_out_channels": [32, 48, 64, 160],
|
| 5 |
+
"neck_out_channels": 64,
|
| 6 |
+
"kernel_list": [3, 2, 2],
|
| 7 |
+
"interpolate_mode": "nearest",
|
| 8 |
+
"dilated_kernel_size": 5,
|
| 9 |
+
"backbone_config": {
|
| 10 |
+
"model_type": "pp_lcnet_v4",
|
| 11 |
+
"stem_channels": [3, 16, 32],
|
| 12 |
+
"stem_type": "large",
|
| 13 |
+
"out_features": ["stage1", "stage2", "stage3", "stage4"],
|
| 14 |
+
"out_indices": [1, 2, 3, 4],
|
| 15 |
+
"block_configs": [
|
| 16 |
+
[[3, 32, 32, 1, true], [3, 32, 32, 1, false]],
|
| 17 |
+
[
|
| 18 |
+
[3, 32, 48, 2, false],
|
| 19 |
+
[3, 48, 48, 1, true],
|
| 20 |
+
[3, 48, 48, 1, false]
|
| 21 |
+
],
|
| 22 |
+
[
|
| 23 |
+
[3, 48, 64, 2, false],
|
| 24 |
+
[3, 64, 64, 1, true],
|
| 25 |
+
[3, 64, 64, 1, false],
|
| 26 |
+
[3, 64, 64, 1, true],
|
| 27 |
+
[3, 64, 64, 1, false]
|
| 28 |
+
],
|
| 29 |
+
[
|
| 30 |
+
[3, 64, 160, 2, false],
|
| 31 |
+
[3, 160, 160, 1, true],
|
| 32 |
+
[3, 160, 160, 1, false]
|
| 33 |
+
]
|
| 34 |
+
]
|
| 35 |
+
}
|
| 36 |
+
}
|
det_v6_tiny/inference.yml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: PP-OCRv6_tiny_det
|
| 3 |
+
Hpi:
|
| 4 |
+
backend_configs:
|
| 5 |
+
paddle_infer:
|
| 6 |
+
trt_dynamic_shapes: &id001
|
| 7 |
+
x:
|
| 8 |
+
- - 1
|
| 9 |
+
- 3
|
| 10 |
+
- 32
|
| 11 |
+
- 32
|
| 12 |
+
- - 1
|
| 13 |
+
- 3
|
| 14 |
+
- 736
|
| 15 |
+
- 736
|
| 16 |
+
- - 1
|
| 17 |
+
- 3
|
| 18 |
+
- 4000
|
| 19 |
+
- 4000
|
| 20 |
+
tensorrt:
|
| 21 |
+
dynamic_shapes: *id001
|
| 22 |
+
PostProcess:
|
| 23 |
+
box_thresh: 0.4
|
| 24 |
+
max_candidates: 3000
|
| 25 |
+
name: DBPostProcess
|
| 26 |
+
thresh: 0.2
|
| 27 |
+
unclip_ratio: 1.4
|
| 28 |
+
PreProcess:
|
| 29 |
+
transform_ops:
|
| 30 |
+
- DecodeImage:
|
| 31 |
+
channel_first: false
|
| 32 |
+
img_mode: BGR
|
| 33 |
+
- DetLabelEncode: null
|
| 34 |
+
- DetResizeForTest: null
|
| 35 |
+
- NormalizeImage:
|
| 36 |
+
mean:
|
| 37 |
+
- 0.485
|
| 38 |
+
- 0.456
|
| 39 |
+
- 0.406
|
| 40 |
+
order: hwc
|
| 41 |
+
scale: 1./255.
|
| 42 |
+
std:
|
| 43 |
+
- 0.229
|
| 44 |
+
- 0.224
|
| 45 |
+
- 0.225
|
| 46 |
+
- ToCHWImage: null
|
| 47 |
+
- KeepKeys:
|
| 48 |
+
keep_keys:
|
| 49 |
+
- image
|
| 50 |
+
- shape
|
| 51 |
+
- polys
|
| 52 |
+
- ignore_tags
|
det_v6_tiny/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:857c47d6896a97149e1ca9dfb4ebc27c2c4fbeeab9b857c14dbfa1e60e6c811b
|
| 3 |
+
size 1786479
|
det_v6_tiny/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cae3c88d2a9902fd0293e6b17990428f54bfa7ec98f800a4368e95423a754d16
|
| 3 |
+
size 1786412
|
det_v6_tiny/preprocessor_config.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_valid_processor_keys": [
|
| 3 |
+
"images",
|
| 4 |
+
"do_resize",
|
| 5 |
+
"size",
|
| 6 |
+
"resample",
|
| 7 |
+
"do_rescale",
|
| 8 |
+
"rescale_factor",
|
| 9 |
+
"do_normalize",
|
| 10 |
+
"image_mean",
|
| 11 |
+
"image_std",
|
| 12 |
+
"return_tensors",
|
| 13 |
+
"data_format",
|
| 14 |
+
"input_data_format"
|
| 15 |
+
],
|
| 16 |
+
"do_convert_rgb": true,
|
| 17 |
+
"do_normalize": true,
|
| 18 |
+
"do_rescale": true,
|
| 19 |
+
"do_resize": true,
|
| 20 |
+
"image_processor_type": "PPOCRV5ServerDetImageProcessor",
|
| 21 |
+
"model_input_names": ["pixel_values", "original_image_size"],
|
| 22 |
+
"image_mode": "BGR",
|
| 23 |
+
"channel_first": false,
|
| 24 |
+
"limit_side_len": 736,
|
| 25 |
+
"limit_type": "min",
|
| 26 |
+
"max_side_limit": 4000,
|
| 27 |
+
"image_mean": [0.406, 0.456, 0.485],
|
| 28 |
+
"image_std": [0.225, 0.224, 0.229],
|
| 29 |
+
"rescale_factor": 0.00392156862745098,
|
| 30 |
+
"resample": 2,
|
| 31 |
+
"normalize_order": "hwc",
|
| 32 |
+
"do_to_chw": true,
|
| 33 |
+
"keep_keys": ["image", "shape", "polys", "ignore_tags"]
|
| 34 |
+
}
|
doclayoutv3/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
doclayoutv3/config.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_dropout": 0.0,
|
| 3 |
+
"activation_function": "silu",
|
| 4 |
+
"anchor_image_size": null,
|
| 5 |
+
"architectures": [
|
| 6 |
+
"PPDocLayoutV3ForObjectDetection"
|
| 7 |
+
],
|
| 8 |
+
"attention_dropout": 0.0,
|
| 9 |
+
"backbone": null,
|
| 10 |
+
"backbone_config": {
|
| 11 |
+
"model_type": "hgnet_v2",
|
| 12 |
+
"arch": "L",
|
| 13 |
+
"return_idx": [0, 1, 2, 3],
|
| 14 |
+
"freeze_stem_only": true,
|
| 15 |
+
"freeze_at": 0,
|
| 16 |
+
"freeze_norm": true,
|
| 17 |
+
"lr_mult_list": [0, 0.05, 0.05, 0.05, 0.05],
|
| 18 |
+
"out_features": ["stage1", "stage2", "stage3", "stage4"]
|
| 19 |
+
},
|
| 20 |
+
"backbone_kwargs": null,
|
| 21 |
+
"batch_norm_eps": 1e-05,
|
| 22 |
+
"box_noise_scale": 1.0,
|
| 23 |
+
"d_model": 256,
|
| 24 |
+
"decoder_activation_function": "relu",
|
| 25 |
+
"decoder_attention_heads": 8,
|
| 26 |
+
"decoder_ffn_dim": 1024,
|
| 27 |
+
"decoder_in_channels": [
|
| 28 |
+
256,
|
| 29 |
+
256,
|
| 30 |
+
256
|
| 31 |
+
],
|
| 32 |
+
"decoder_layers": 6,
|
| 33 |
+
"decoder_n_points": 4,
|
| 34 |
+
"disable_custom_kernels": true,
|
| 35 |
+
"dropout": 0.0,
|
| 36 |
+
"encode_proj_layers": [
|
| 37 |
+
2
|
| 38 |
+
],
|
| 39 |
+
"encoder_activation_function": "gelu",
|
| 40 |
+
"encoder_attention_heads": 8,
|
| 41 |
+
"encoder_ffn_dim": 1024,
|
| 42 |
+
"encoder_hidden_dim": 256,
|
| 43 |
+
"encoder_in_channels": [
|
| 44 |
+
512,
|
| 45 |
+
1024,
|
| 46 |
+
2048
|
| 47 |
+
],
|
| 48 |
+
"encoder_layers": 1,
|
| 49 |
+
"eos_coefficient": 0.0001,
|
| 50 |
+
"eval_size": null,
|
| 51 |
+
"feature_strides": [
|
| 52 |
+
8,
|
| 53 |
+
16,
|
| 54 |
+
32
|
| 55 |
+
],
|
| 56 |
+
"hidden_expansion": 1.0,
|
| 57 |
+
"id2label": {
|
| 58 |
+
"0": "abstract",
|
| 59 |
+
"1": "algorithm",
|
| 60 |
+
"2": "aside_text",
|
| 61 |
+
"3": "chart",
|
| 62 |
+
"4": "content",
|
| 63 |
+
"5": "formula",
|
| 64 |
+
"6": "doc_title",
|
| 65 |
+
"7": "figure_title",
|
| 66 |
+
"8": "footer",
|
| 67 |
+
"9": "footer",
|
| 68 |
+
"10": "footnote",
|
| 69 |
+
"11": "formula_number",
|
| 70 |
+
"12": "header",
|
| 71 |
+
"13": "header",
|
| 72 |
+
"14": "image",
|
| 73 |
+
"15": "formula",
|
| 74 |
+
"16": "number",
|
| 75 |
+
"17": "paragraph_title",
|
| 76 |
+
"18": "reference",
|
| 77 |
+
"19": "reference_content",
|
| 78 |
+
"20": "seal",
|
| 79 |
+
"21": "table",
|
| 80 |
+
"22": "text",
|
| 81 |
+
"23": "text",
|
| 82 |
+
"24": "vision_footnote"
|
| 83 |
+
},
|
| 84 |
+
"initializer_range": 0.01,
|
| 85 |
+
"is_encoder_decoder": true,
|
| 86 |
+
"label2id": {},
|
| 87 |
+
"label_noise_ratio": 0.5,
|
| 88 |
+
"layer_norm_eps": 1e-05,
|
| 89 |
+
"learn_initial_query": false,
|
| 90 |
+
"matcher_alpha": 0.25,
|
| 91 |
+
"matcher_bbox_cost": 5.0,
|
| 92 |
+
"matcher_class_cost": 2.0,
|
| 93 |
+
"matcher_gamma": 2.0,
|
| 94 |
+
"matcher_giou_cost": 2.0,
|
| 95 |
+
"model_type": "pp_doclayout_v3",
|
| 96 |
+
"normalize_before": false,
|
| 97 |
+
"num_denoising": 100,
|
| 98 |
+
"num_feature_levels": 3,
|
| 99 |
+
"num_queries": 300,
|
| 100 |
+
"positional_encoding_temperature": 10000,
|
| 101 |
+
"torch_dtype": "float32",
|
| 102 |
+
"use_pretrained_backbone": false,
|
| 103 |
+
"use_timm_backbone": false,
|
| 104 |
+
"global_pointer_head_size": 64,
|
| 105 |
+
"mask_feature_channels": [64, 64],
|
| 106 |
+
"x4_feat_dim": 128
|
| 107 |
+
}
|
doclayoutv3/inference.yml
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mode: paddle
|
| 2 |
+
draw_threshold: 0.5
|
| 3 |
+
metric: COCO
|
| 4 |
+
use_dynamic_shape: false
|
| 5 |
+
Global:
|
| 6 |
+
model_name: PP-DocLayoutV3
|
| 7 |
+
arch: DETR
|
| 8 |
+
min_subgraph_size: 3
|
| 9 |
+
Preprocess:
|
| 10 |
+
- interp: 2
|
| 11 |
+
keep_ratio: false
|
| 12 |
+
target_size:
|
| 13 |
+
- 800
|
| 14 |
+
- 800
|
| 15 |
+
type: Resize
|
| 16 |
+
- mean:
|
| 17 |
+
- 0.0
|
| 18 |
+
- 0.0
|
| 19 |
+
- 0.0
|
| 20 |
+
norm_type: none
|
| 21 |
+
std:
|
| 22 |
+
- 1.0
|
| 23 |
+
- 1.0
|
| 24 |
+
- 1.0
|
| 25 |
+
type: NormalizeImage
|
| 26 |
+
- type: Permute
|
| 27 |
+
label_list:
|
| 28 |
+
- abstract
|
| 29 |
+
- algorithm
|
| 30 |
+
- aside_text
|
| 31 |
+
- chart
|
| 32 |
+
- content
|
| 33 |
+
- display_formula
|
| 34 |
+
- doc_title
|
| 35 |
+
- figure_title
|
| 36 |
+
- footer
|
| 37 |
+
- footer_image
|
| 38 |
+
- footnote
|
| 39 |
+
- formula_number
|
| 40 |
+
- header
|
| 41 |
+
- header_image
|
| 42 |
+
- image
|
| 43 |
+
- inline_formula
|
| 44 |
+
- number
|
| 45 |
+
- paragraph_title
|
| 46 |
+
- reference
|
| 47 |
+
- reference_content
|
| 48 |
+
- seal
|
| 49 |
+
- table
|
| 50 |
+
- text
|
| 51 |
+
- vertical_text
|
| 52 |
+
- vision_footnote
|
| 53 |
+
Hpi:
|
| 54 |
+
backend_configs:
|
| 55 |
+
paddle_infer:
|
| 56 |
+
trt_dynamic_shapes: &id001
|
| 57 |
+
image:
|
| 58 |
+
- - 1
|
| 59 |
+
- 3
|
| 60 |
+
- 800
|
| 61 |
+
- 800
|
| 62 |
+
- - 1
|
| 63 |
+
- 3
|
| 64 |
+
- 800
|
| 65 |
+
- 800
|
| 66 |
+
- - 8
|
| 67 |
+
- 3
|
| 68 |
+
- 800
|
| 69 |
+
- 800
|
| 70 |
+
scale_factor:
|
| 71 |
+
- - 1
|
| 72 |
+
- 2
|
| 73 |
+
- - 1
|
| 74 |
+
- 2
|
| 75 |
+
- - 8
|
| 76 |
+
- 2
|
| 77 |
+
trt_dynamic_shape_input_data:
|
| 78 |
+
scale_factor:
|
| 79 |
+
- - 2
|
| 80 |
+
- 2
|
| 81 |
+
- - 1
|
| 82 |
+
- 1
|
| 83 |
+
- - 0.67
|
| 84 |
+
- 0.67
|
| 85 |
+
- 0.67
|
| 86 |
+
- 0.67
|
| 87 |
+
- 0.67
|
| 88 |
+
- 0.67
|
| 89 |
+
- 0.67
|
| 90 |
+
- 0.67
|
| 91 |
+
- 0.67
|
| 92 |
+
- 0.67
|
| 93 |
+
- 0.67
|
| 94 |
+
- 0.67
|
| 95 |
+
- 0.67
|
| 96 |
+
- 0.67
|
| 97 |
+
- 0.67
|
| 98 |
+
- 0.67
|
| 99 |
+
tensorrt:
|
| 100 |
+
dynamic_shapes: *id001
|
doclayoutv3/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afe29ada358026dfc04485a5505e4982faf44920ee74f4d99f73becca285b65a
|
| 3 |
+
size 133828033
|
doclayoutv3/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ea422c6cc5fe759a47e1357c35639b58173508e025a3131cbe4b6ac59e2b85e
|
| 3 |
+
size 133270468
|
doclayoutv3/preprocessor_config.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_valid_processor_keys": [
|
| 3 |
+
"images",
|
| 4 |
+
"do_resize",
|
| 5 |
+
"size",
|
| 6 |
+
"resample",
|
| 7 |
+
"do_rescale",
|
| 8 |
+
"rescale_factor",
|
| 9 |
+
"do_normalize",
|
| 10 |
+
"image_mean",
|
| 11 |
+
"image_std",
|
| 12 |
+
"return_tensors",
|
| 13 |
+
"data_format",
|
| 14 |
+
"input_data_format"
|
| 15 |
+
],
|
| 16 |
+
"do_normalize": true,
|
| 17 |
+
"do_rescale": true,
|
| 18 |
+
"do_resize": true,
|
| 19 |
+
"image_mean": [
|
| 20 |
+
0,
|
| 21 |
+
0,
|
| 22 |
+
0
|
| 23 |
+
],
|
| 24 |
+
"image_processor_type": "PPDocLayoutV3ImageProcessor",
|
| 25 |
+
"image_std": [
|
| 26 |
+
1,
|
| 27 |
+
1,
|
| 28 |
+
1
|
| 29 |
+
],
|
| 30 |
+
"resample": 3,
|
| 31 |
+
"rescale_factor": 0.00392156862745098,
|
| 32 |
+
"size": {
|
| 33 |
+
"height": 800,
|
| 34 |
+
"width": 800
|
| 35 |
+
}
|
| 36 |
+
}
|
en_rec/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
en_rec/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
en_rec/config.json
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv5_mobile_rec",
|
| 3 |
+
"backbone_config": {
|
| 4 |
+
"model_type": "pp_lcnet_v3",
|
| 5 |
+
"scale": 0.95,
|
| 6 |
+
"out_features": [
|
| 7 |
+
"stage2",
|
| 8 |
+
"stage3",
|
| 9 |
+
"stage4",
|
| 10 |
+
"stage5"
|
| 11 |
+
],
|
| 12 |
+
"out_indices": [
|
| 13 |
+
2,
|
| 14 |
+
3,
|
| 15 |
+
4,
|
| 16 |
+
5
|
| 17 |
+
],
|
| 18 |
+
"divisor": 16,
|
| 19 |
+
"block_configs": [
|
| 20 |
+
[
|
| 21 |
+
[
|
| 22 |
+
3,
|
| 23 |
+
16,
|
| 24 |
+
32,
|
| 25 |
+
1,
|
| 26 |
+
false
|
| 27 |
+
]
|
| 28 |
+
],
|
| 29 |
+
[
|
| 30 |
+
[
|
| 31 |
+
3,
|
| 32 |
+
32,
|
| 33 |
+
64,
|
| 34 |
+
1,
|
| 35 |
+
false
|
| 36 |
+
],
|
| 37 |
+
[
|
| 38 |
+
3,
|
| 39 |
+
64,
|
| 40 |
+
64,
|
| 41 |
+
1,
|
| 42 |
+
false
|
| 43 |
+
]
|
| 44 |
+
],
|
| 45 |
+
[
|
| 46 |
+
[
|
| 47 |
+
3,
|
| 48 |
+
64,
|
| 49 |
+
128,
|
| 50 |
+
[
|
| 51 |
+
2,
|
| 52 |
+
1
|
| 53 |
+
],
|
| 54 |
+
false
|
| 55 |
+
],
|
| 56 |
+
[
|
| 57 |
+
3,
|
| 58 |
+
128,
|
| 59 |
+
128,
|
| 60 |
+
1,
|
| 61 |
+
false
|
| 62 |
+
]
|
| 63 |
+
],
|
| 64 |
+
[
|
| 65 |
+
[
|
| 66 |
+
3,
|
| 67 |
+
128,
|
| 68 |
+
256,
|
| 69 |
+
[
|
| 70 |
+
1,
|
| 71 |
+
2
|
| 72 |
+
],
|
| 73 |
+
false
|
| 74 |
+
],
|
| 75 |
+
[
|
| 76 |
+
5,
|
| 77 |
+
256,
|
| 78 |
+
256,
|
| 79 |
+
1,
|
| 80 |
+
false
|
| 81 |
+
],
|
| 82 |
+
[
|
| 83 |
+
5,
|
| 84 |
+
256,
|
| 85 |
+
256,
|
| 86 |
+
1,
|
| 87 |
+
false
|
| 88 |
+
],
|
| 89 |
+
[
|
| 90 |
+
5,
|
| 91 |
+
256,
|
| 92 |
+
256,
|
| 93 |
+
1,
|
| 94 |
+
false
|
| 95 |
+
],
|
| 96 |
+
[
|
| 97 |
+
5,
|
| 98 |
+
256,
|
| 99 |
+
256,
|
| 100 |
+
1,
|
| 101 |
+
false
|
| 102 |
+
]
|
| 103 |
+
],
|
| 104 |
+
[
|
| 105 |
+
[
|
| 106 |
+
5,
|
| 107 |
+
256,
|
| 108 |
+
512,
|
| 109 |
+
[
|
| 110 |
+
2,
|
| 111 |
+
1
|
| 112 |
+
],
|
| 113 |
+
true
|
| 114 |
+
],
|
| 115 |
+
[
|
| 116 |
+
5,
|
| 117 |
+
512,
|
| 118 |
+
512,
|
| 119 |
+
1,
|
| 120 |
+
true
|
| 121 |
+
],
|
| 122 |
+
[
|
| 123 |
+
5,
|
| 124 |
+
512,
|
| 125 |
+
512,
|
| 126 |
+
[
|
| 127 |
+
2,
|
| 128 |
+
1
|
| 129 |
+
],
|
| 130 |
+
false
|
| 131 |
+
],
|
| 132 |
+
[
|
| 133 |
+
5,
|
| 134 |
+
512,
|
| 135 |
+
512,
|
| 136 |
+
1,
|
| 137 |
+
false
|
| 138 |
+
]
|
| 139 |
+
]
|
| 140 |
+
]
|
| 141 |
+
},
|
| 142 |
+
"hidden_act": "silu",
|
| 143 |
+
"hidden_size": 120,
|
| 144 |
+
"mlp_ratio": 2.0,
|
| 145 |
+
"depth": 2,
|
| 146 |
+
"head_out_channels": 438,
|
| 147 |
+
"conv_kernel_size": [
|
| 148 |
+
1,
|
| 149 |
+
3
|
| 150 |
+
],
|
| 151 |
+
"qkv_bias": true,
|
| 152 |
+
"num_attention_heads": 8,
|
| 153 |
+
"attention_dropout": 0.0
|
| 154 |
+
}
|
en_rec/inference.yml
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Global:
|
| 2 |
+
model_name: en_PP-OCRv5_mobile_rec
|
| 3 |
+
Hpi:
|
| 4 |
+
backend_configs:
|
| 5 |
+
paddle_infer:
|
| 6 |
+
trt_dynamic_shapes: &id001
|
| 7 |
+
x:
|
| 8 |
+
- - 1
|
| 9 |
+
- 3
|
| 10 |
+
- 48
|
| 11 |
+
- 160
|
| 12 |
+
- - 1
|
| 13 |
+
- 3
|
| 14 |
+
- 48
|
| 15 |
+
- 320
|
| 16 |
+
- - 8
|
| 17 |
+
- 3
|
| 18 |
+
- 48
|
| 19 |
+
- 3200
|
| 20 |
+
tensorrt:
|
| 21 |
+
dynamic_shapes: *id001
|
| 22 |
+
PostProcess:
|
| 23 |
+
character_dict:
|
| 24 |
+
- '0'
|
| 25 |
+
- '1'
|
| 26 |
+
- '2'
|
| 27 |
+
- '3'
|
| 28 |
+
- '4'
|
| 29 |
+
- '5'
|
| 30 |
+
- '6'
|
| 31 |
+
- '7'
|
| 32 |
+
- '8'
|
| 33 |
+
- '9'
|
| 34 |
+
- A
|
| 35 |
+
- B
|
| 36 |
+
- C
|
| 37 |
+
- D
|
| 38 |
+
- E
|
| 39 |
+
- F
|
| 40 |
+
- G
|
| 41 |
+
- H
|
| 42 |
+
- I
|
| 43 |
+
- J
|
| 44 |
+
- K
|
| 45 |
+
- L
|
| 46 |
+
- M
|
| 47 |
+
- N
|
| 48 |
+
- O
|
| 49 |
+
- P
|
| 50 |
+
- Q
|
| 51 |
+
- R
|
| 52 |
+
- S
|
| 53 |
+
- T
|
| 54 |
+
- U
|
| 55 |
+
- V
|
| 56 |
+
- W
|
| 57 |
+
- X
|
| 58 |
+
- Y
|
| 59 |
+
- Z
|
| 60 |
+
- a
|
| 61 |
+
- b
|
| 62 |
+
- c
|
| 63 |
+
- d
|
| 64 |
+
- e
|
| 65 |
+
- f
|
| 66 |
+
- g
|
| 67 |
+
- h
|
| 68 |
+
- i
|
| 69 |
+
- j
|
| 70 |
+
- k
|
| 71 |
+
- l
|
| 72 |
+
- m
|
| 73 |
+
- n
|
| 74 |
+
- o
|
| 75 |
+
- p
|
| 76 |
+
- q
|
| 77 |
+
- r
|
| 78 |
+
- s
|
| 79 |
+
- t
|
| 80 |
+
- u
|
| 81 |
+
- v
|
| 82 |
+
- w
|
| 83 |
+
- x
|
| 84 |
+
- y
|
| 85 |
+
- z
|
| 86 |
+
- '!'
|
| 87 |
+
- '"'
|
| 88 |
+
- '#'
|
| 89 |
+
- $
|
| 90 |
+
- '%'
|
| 91 |
+
- '&'
|
| 92 |
+
- ''''
|
| 93 |
+
- (
|
| 94 |
+
- )
|
| 95 |
+
- '*'
|
| 96 |
+
- +
|
| 97 |
+
- ','
|
| 98 |
+
- '-'
|
| 99 |
+
- .
|
| 100 |
+
- /
|
| 101 |
+
- ':'
|
| 102 |
+
- ;
|
| 103 |
+
- <
|
| 104 |
+
- '='
|
| 105 |
+
- '>'
|
| 106 |
+
- '?'
|
| 107 |
+
- '@'
|
| 108 |
+
- '['
|
| 109 |
+
- \
|
| 110 |
+
- ']'
|
| 111 |
+
- _
|
| 112 |
+
- '`'
|
| 113 |
+
- '{'
|
| 114 |
+
- '|'
|
| 115 |
+
- '}'
|
| 116 |
+
- ^
|
| 117 |
+
- '~'
|
| 118 |
+
- ©
|
| 119 |
+
- ®
|
| 120 |
+
- ℉
|
| 121 |
+
- №
|
| 122 |
+
- Ω
|
| 123 |
+
- ℮
|
| 124 |
+
- ™
|
| 125 |
+
- ∆
|
| 126 |
+
- ✓
|
| 127 |
+
- ✔
|
| 128 |
+
- ✗
|
| 129 |
+
- ✘
|
| 130 |
+
- ✕
|
| 131 |
+
- ☑
|
| 132 |
+
- ☒
|
| 133 |
+
- ●
|
| 134 |
+
- ▪
|
| 135 |
+
- ▫
|
| 136 |
+
- ◼
|
| 137 |
+
- ▶
|
| 138 |
+
- ◀
|
| 139 |
+
- ⬆
|
| 140 |
+
- ¤
|
| 141 |
+
- ¦
|
| 142 |
+
- §
|
| 143 |
+
- ¨
|
| 144 |
+
- ª
|
| 145 |
+
- «
|
| 146 |
+
- ¬
|
| 147 |
+
- ¯
|
| 148 |
+
- °
|
| 149 |
+
- ²
|
| 150 |
+
- ³
|
| 151 |
+
- ´
|
| 152 |
+
- µ
|
| 153 |
+
- ¶
|
| 154 |
+
- ¸
|
| 155 |
+
- ¹
|
| 156 |
+
- º
|
| 157 |
+
- »
|
| 158 |
+
- ¼
|
| 159 |
+
- ½
|
| 160 |
+
- ¾
|
| 161 |
+
- ¿
|
| 162 |
+
- ×
|
| 163 |
+
- ‐
|
| 164 |
+
- ‑
|
| 165 |
+
- ‒
|
| 166 |
+
- —
|
| 167 |
+
- ―
|
| 168 |
+
- ‖
|
| 169 |
+
- ‗
|
| 170 |
+
- ‘
|
| 171 |
+
- ’
|
| 172 |
+
- ‚
|
| 173 |
+
- ‛
|
| 174 |
+
- “
|
| 175 |
+
- ”
|
| 176 |
+
- „
|
| 177 |
+
- ‟
|
| 178 |
+
- †
|
| 179 |
+
- ‡
|
| 180 |
+
- ‣
|
| 181 |
+
- ․
|
| 182 |
+
- …
|
| 183 |
+
- ‧
|
| 184 |
+
- ‰
|
| 185 |
+
- ‴
|
| 186 |
+
- ‵
|
| 187 |
+
- ‶
|
| 188 |
+
- ‷
|
| 189 |
+
- ‸
|
| 190 |
+
- ‹
|
| 191 |
+
- ›
|
| 192 |
+
- ※
|
| 193 |
+
- ‼
|
| 194 |
+
- ‽
|
| 195 |
+
- ‾
|
| 196 |
+
- −
|
| 197 |
+
- ₤
|
| 198 |
+
- ₡
|
| 199 |
+
- ₹
|
| 200 |
+
- ₽
|
| 201 |
+
- ₴
|
| 202 |
+
- ₿
|
| 203 |
+
- ¢
|
| 204 |
+
- €
|
| 205 |
+
- £
|
| 206 |
+
- ¥
|
| 207 |
+
- Ⅰ
|
| 208 |
+
- Ⅱ
|
| 209 |
+
- Ⅲ
|
| 210 |
+
- Ⅳ
|
| 211 |
+
- Ⅴ
|
| 212 |
+
- Ⅵ
|
| 213 |
+
- Ⅶ
|
| 214 |
+
- Ⅷ
|
| 215 |
+
- Ⅸ
|
| 216 |
+
- Ⅹ
|
| 217 |
+
- Ⅺ
|
| 218 |
+
- Ⅻ
|
| 219 |
+
- ⅰ
|
| 220 |
+
- ⅱ
|
| 221 |
+
- ⅲ
|
| 222 |
+
- ⅳ
|
| 223 |
+
- ⅴ
|
| 224 |
+
- ⅵ
|
| 225 |
+
- ⅶ
|
| 226 |
+
- ⅷ
|
| 227 |
+
- ⅸ
|
| 228 |
+
- ⅹ
|
| 229 |
+
- ⅺ
|
| 230 |
+
- ⅻ
|
| 231 |
+
- ➀
|
| 232 |
+
- ➁
|
| 233 |
+
- ➂
|
| 234 |
+
- ➃
|
| 235 |
+
- ➄
|
| 236 |
+
- ➅
|
| 237 |
+
- ➆
|
| 238 |
+
- ➇
|
| 239 |
+
- ➈
|
| 240 |
+
- ➉
|
| 241 |
+
- ➊
|
| 242 |
+
- ➋
|
| 243 |
+
- ➌
|
| 244 |
+
- ➍
|
| 245 |
+
- ➎
|
| 246 |
+
- ➏
|
| 247 |
+
- ➐
|
| 248 |
+
- ➑
|
| 249 |
+
- ➒
|
| 250 |
+
- ➓
|
| 251 |
+
- ❶
|
| 252 |
+
- ❷
|
| 253 |
+
- ❸
|
| 254 |
+
- ❹
|
| 255 |
+
- ❺
|
| 256 |
+
- ❻
|
| 257 |
+
- ❼
|
| 258 |
+
- ❽
|
| 259 |
+
- ❾
|
| 260 |
+
- ❿
|
| 261 |
+
- ①
|
| 262 |
+
- ②
|
| 263 |
+
- ③
|
| 264 |
+
- ④
|
| 265 |
+
- ⑤
|
| 266 |
+
- ⑥
|
| 267 |
+
- ⑦
|
| 268 |
+
- ⑧
|
| 269 |
+
- ⑨
|
| 270 |
+
- ⑩
|
| 271 |
+
- ↑
|
| 272 |
+
- →
|
| 273 |
+
- ↓
|
| 274 |
+
- ↕
|
| 275 |
+
- ←
|
| 276 |
+
- ↔
|
| 277 |
+
- ⇒
|
| 278 |
+
- ⇐
|
| 279 |
+
- ⇔
|
| 280 |
+
- ∀
|
| 281 |
+
- ∃
|
| 282 |
+
- ∄
|
| 283 |
+
- ∴
|
| 284 |
+
- ∵
|
| 285 |
+
- ∝
|
| 286 |
+
- ∞
|
| 287 |
+
- ∩
|
| 288 |
+
- ∪
|
| 289 |
+
- ∂
|
| 290 |
+
- ∫
|
| 291 |
+
- ∬
|
| 292 |
+
- ∭
|
| 293 |
+
- ∮
|
| 294 |
+
- ∯
|
| 295 |
+
- ∰
|
| 296 |
+
- ∑
|
| 297 |
+
- ∏
|
| 298 |
+
- √
|
| 299 |
+
- ∛
|
| 300 |
+
- ∜
|
| 301 |
+
- ∱
|
| 302 |
+
- ∲
|
| 303 |
+
- ∳
|
| 304 |
+
- ∶
|
| 305 |
+
- ∷
|
| 306 |
+
- ∼
|
| 307 |
+
- ∖
|
| 308 |
+
- ∗
|
| 309 |
+
- ≈
|
| 310 |
+
- ≠
|
| 311 |
+
- ≡
|
| 312 |
+
- ≤
|
| 313 |
+
- ≥
|
| 314 |
+
- ⊂
|
| 315 |
+
- ⊃
|
| 316 |
+
- ⊥
|
| 317 |
+
- ⊾
|
| 318 |
+
- ⊿
|
| 319 |
+
- □
|
| 320 |
+
- ∥
|
| 321 |
+
- ∋
|
| 322 |
+
- ƒ
|
| 323 |
+
- ′
|
| 324 |
+
- ″
|
| 325 |
+
- À
|
| 326 |
+
- Á
|
| 327 |
+
- Â
|
| 328 |
+
- Ã
|
| 329 |
+
- Ä
|
| 330 |
+
- Å
|
| 331 |
+
- Æ
|
| 332 |
+
- Ç
|
| 333 |
+
- È
|
| 334 |
+
- É
|
| 335 |
+
- Ê
|
| 336 |
+
- Ë
|
| 337 |
+
- Ì
|
| 338 |
+
- Í
|
| 339 |
+
- Î
|
| 340 |
+
- Ï
|
| 341 |
+
- Ð
|
| 342 |
+
- Ñ
|
| 343 |
+
- Ò
|
| 344 |
+
- Ó
|
| 345 |
+
- Ô
|
| 346 |
+
- Õ
|
| 347 |
+
- Ö
|
| 348 |
+
- Ø
|
| 349 |
+
- Ù
|
| 350 |
+
- Ú
|
| 351 |
+
- Û
|
| 352 |
+
- Ü
|
| 353 |
+
- Ý
|
| 354 |
+
- Þ
|
| 355 |
+
- à
|
| 356 |
+
- á
|
| 357 |
+
- â
|
| 358 |
+
- ã
|
| 359 |
+
- ä
|
| 360 |
+
- å
|
| 361 |
+
- æ
|
| 362 |
+
- ç
|
| 363 |
+
- è
|
| 364 |
+
- é
|
| 365 |
+
- ê
|
| 366 |
+
- ë
|
| 367 |
+
- ì
|
| 368 |
+
- í
|
| 369 |
+
- î
|
| 370 |
+
- ï
|
| 371 |
+
- ð
|
| 372 |
+
- ñ
|
| 373 |
+
- ò
|
| 374 |
+
- ó
|
| 375 |
+
- ô
|
| 376 |
+
- õ
|
| 377 |
+
- ö
|
| 378 |
+
- ø
|
| 379 |
+
- ù
|
| 380 |
+
- ú
|
| 381 |
+
- û
|
| 382 |
+
- ü
|
| 383 |
+
- ý
|
| 384 |
+
- þ
|
| 385 |
+
- ÿ
|
| 386 |
+
- Α
|
| 387 |
+
- Β
|
| 388 |
+
- Γ
|
| 389 |
+
- Δ
|
| 390 |
+
- Ε
|
| 391 |
+
- Ζ
|
| 392 |
+
- Η
|
| 393 |
+
- Θ
|
| 394 |
+
- Ι
|
| 395 |
+
- Κ
|
| 396 |
+
- Λ
|
| 397 |
+
- Μ
|
| 398 |
+
- Ν
|
| 399 |
+
- Ξ
|
| 400 |
+
- Ο
|
| 401 |
+
- Π
|
| 402 |
+
- Ρ
|
| 403 |
+
- Σ
|
| 404 |
+
- Τ
|
| 405 |
+
- Υ
|
| 406 |
+
- Φ
|
| 407 |
+
- Χ
|
| 408 |
+
- Ψ
|
| 409 |
+
- Ω
|
| 410 |
+
- α
|
| 411 |
+
- β
|
| 412 |
+
- γ
|
| 413 |
+
- δ
|
| 414 |
+
- ε
|
| 415 |
+
- ζ
|
| 416 |
+
- η
|
| 417 |
+
- θ
|
| 418 |
+
- ι
|
| 419 |
+
- κ
|
| 420 |
+
- λ
|
| 421 |
+
- μ
|
| 422 |
+
- ν
|
| 423 |
+
- ξ
|
| 424 |
+
- ο
|
| 425 |
+
- π
|
| 426 |
+
- ρ
|
| 427 |
+
- σ
|
| 428 |
+
- ς
|
| 429 |
+
- τ
|
| 430 |
+
- υ
|
| 431 |
+
- φ
|
| 432 |
+
- χ
|
| 433 |
+
- ψ
|
| 434 |
+
- ω
|
| 435 |
+
- Å
|
| 436 |
+
- ℏ
|
| 437 |
+
- ⌀
|
| 438 |
+
- ⍺
|
| 439 |
+
- ⍵
|
| 440 |
+
- 𝑢
|
| 441 |
+
- 𝜓
|
| 442 |
+
- ०
|
| 443 |
+
- ‥
|
| 444 |
+
- ︽
|
| 445 |
+
- ﹥
|
| 446 |
+
- •
|
| 447 |
+
- ÷
|
| 448 |
+
- ∕
|
| 449 |
+
- ∙
|
| 450 |
+
- ⋅
|
| 451 |
+
- ·
|
| 452 |
+
- ±
|
| 453 |
+
- ∓
|
| 454 |
+
- ∟
|
| 455 |
+
- ∠
|
| 456 |
+
- ∡
|
| 457 |
+
- ∢
|
| 458 |
+
- ℧
|
| 459 |
+
- ☺
|
| 460 |
+
name: CTCLabelDecode
|
| 461 |
+
PreProcess:
|
| 462 |
+
transform_ops:
|
| 463 |
+
- DecodeImage:
|
| 464 |
+
channel_first: false
|
| 465 |
+
img_mode: BGR
|
| 466 |
+
- MultiLabelEncode:
|
| 467 |
+
gtc_encode: NRTRLabelEncode
|
| 468 |
+
- RecResizeImg:
|
| 469 |
+
image_shape:
|
| 470 |
+
- 3
|
| 471 |
+
- 48
|
| 472 |
+
- 320
|
| 473 |
+
- KeepKeys:
|
| 474 |
+
keep_keys:
|
| 475 |
+
- image
|
| 476 |
+
- label_ctc
|
| 477 |
+
- label_gtc
|
| 478 |
+
- length
|
| 479 |
+
- valid_ratio
|
en_rec/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:677ecbf612190434fb76a0e17f360b25a01355e24ddbb37c27480fef1e3232f3
|
| 3 |
+
size 22465962
|
en_rec/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9dab63fb9b819082f3f06e889a3af56dc2c27155d46d8409659c869a2aece2bc
|
| 3 |
+
size 22465008
|
en_rec/preprocessor_config.json
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_ocrv5_mobile_rec",
|
| 3 |
+
"size": {
|
| 4 |
+
"height": 48,
|
| 5 |
+
"width": 320
|
| 6 |
+
},
|
| 7 |
+
"pad_size": {
|
| 8 |
+
"height": 48,
|
| 9 |
+
"width": 320
|
| 10 |
+
},
|
| 11 |
+
"do_resize": true,
|
| 12 |
+
"do_rescale": true,
|
| 13 |
+
"do_convert_rgb": true,
|
| 14 |
+
"do_normalize": true,
|
| 15 |
+
"do_pad": true,
|
| 16 |
+
"max_image_width": 3200,
|
| 17 |
+
"character_list": [
|
| 18 |
+
"blank",
|
| 19 |
+
"0",
|
| 20 |
+
"1",
|
| 21 |
+
"2",
|
| 22 |
+
"3",
|
| 23 |
+
"4",
|
| 24 |
+
"5",
|
| 25 |
+
"6",
|
| 26 |
+
"7",
|
| 27 |
+
"8",
|
| 28 |
+
"9",
|
| 29 |
+
"A",
|
| 30 |
+
"B",
|
| 31 |
+
"C",
|
| 32 |
+
"D",
|
| 33 |
+
"E",
|
| 34 |
+
"F",
|
| 35 |
+
"G",
|
| 36 |
+
"H",
|
| 37 |
+
"I",
|
| 38 |
+
"J",
|
| 39 |
+
"K",
|
| 40 |
+
"L",
|
| 41 |
+
"M",
|
| 42 |
+
"N",
|
| 43 |
+
"O",
|
| 44 |
+
"P",
|
| 45 |
+
"Q",
|
| 46 |
+
"R",
|
| 47 |
+
"S",
|
| 48 |
+
"T",
|
| 49 |
+
"U",
|
| 50 |
+
"V",
|
| 51 |
+
"W",
|
| 52 |
+
"X",
|
| 53 |
+
"Y",
|
| 54 |
+
"Z",
|
| 55 |
+
"a",
|
| 56 |
+
"b",
|
| 57 |
+
"c",
|
| 58 |
+
"d",
|
| 59 |
+
"e",
|
| 60 |
+
"f",
|
| 61 |
+
"g",
|
| 62 |
+
"h",
|
| 63 |
+
"i",
|
| 64 |
+
"j",
|
| 65 |
+
"k",
|
| 66 |
+
"l",
|
| 67 |
+
"m",
|
| 68 |
+
"n",
|
| 69 |
+
"o",
|
| 70 |
+
"p",
|
| 71 |
+
"q",
|
| 72 |
+
"r",
|
| 73 |
+
"s",
|
| 74 |
+
"t",
|
| 75 |
+
"u",
|
| 76 |
+
"v",
|
| 77 |
+
"w",
|
| 78 |
+
"x",
|
| 79 |
+
"y",
|
| 80 |
+
"z",
|
| 81 |
+
"!",
|
| 82 |
+
"\"",
|
| 83 |
+
"#",
|
| 84 |
+
"$",
|
| 85 |
+
"%",
|
| 86 |
+
"&",
|
| 87 |
+
"'",
|
| 88 |
+
"(",
|
| 89 |
+
")",
|
| 90 |
+
"*",
|
| 91 |
+
"+",
|
| 92 |
+
",",
|
| 93 |
+
"-",
|
| 94 |
+
".",
|
| 95 |
+
"/",
|
| 96 |
+
":",
|
| 97 |
+
";",
|
| 98 |
+
"<",
|
| 99 |
+
"=",
|
| 100 |
+
">",
|
| 101 |
+
"?",
|
| 102 |
+
"@",
|
| 103 |
+
"[",
|
| 104 |
+
"\\",
|
| 105 |
+
"]",
|
| 106 |
+
"_",
|
| 107 |
+
"`",
|
| 108 |
+
"{",
|
| 109 |
+
"|",
|
| 110 |
+
"}",
|
| 111 |
+
"^",
|
| 112 |
+
"~",
|
| 113 |
+
"©",
|
| 114 |
+
"®",
|
| 115 |
+
"℉",
|
| 116 |
+
"№",
|
| 117 |
+
"Ω",
|
| 118 |
+
"℮",
|
| 119 |
+
"™",
|
| 120 |
+
"∆",
|
| 121 |
+
"✓",
|
| 122 |
+
"✔",
|
| 123 |
+
"✗",
|
| 124 |
+
"✘",
|
| 125 |
+
"✕",
|
| 126 |
+
"☑",
|
| 127 |
+
"☒",
|
| 128 |
+
"●",
|
| 129 |
+
"▪",
|
| 130 |
+
"▫",
|
| 131 |
+
"◼",
|
| 132 |
+
"▶",
|
| 133 |
+
"◀",
|
| 134 |
+
"⬆",
|
| 135 |
+
"¤",
|
| 136 |
+
"¦",
|
| 137 |
+
"§",
|
| 138 |
+
"¨",
|
| 139 |
+
"ª",
|
| 140 |
+
"«",
|
| 141 |
+
"¬",
|
| 142 |
+
"¯",
|
| 143 |
+
"°",
|
| 144 |
+
"²",
|
| 145 |
+
"³",
|
| 146 |
+
"´",
|
| 147 |
+
"µ",
|
| 148 |
+
"¶",
|
| 149 |
+
"¸",
|
| 150 |
+
"¹",
|
| 151 |
+
"º",
|
| 152 |
+
"»",
|
| 153 |
+
"¼",
|
| 154 |
+
"½",
|
| 155 |
+
"¾",
|
| 156 |
+
"¿",
|
| 157 |
+
"×",
|
| 158 |
+
"‐",
|
| 159 |
+
"‑",
|
| 160 |
+
"‒",
|
| 161 |
+
"—",
|
| 162 |
+
"―",
|
| 163 |
+
"‖",
|
| 164 |
+
"‗",
|
| 165 |
+
"‘",
|
| 166 |
+
"’",
|
| 167 |
+
"‚",
|
| 168 |
+
"‛",
|
| 169 |
+
"“",
|
| 170 |
+
"”",
|
| 171 |
+
"„",
|
| 172 |
+
"‟",
|
| 173 |
+
"†",
|
| 174 |
+
"‡",
|
| 175 |
+
"‣",
|
| 176 |
+
"․",
|
| 177 |
+
"…",
|
| 178 |
+
"‧",
|
| 179 |
+
"‰",
|
| 180 |
+
"‴",
|
| 181 |
+
"‵",
|
| 182 |
+
"‶",
|
| 183 |
+
"‷",
|
| 184 |
+
"‸",
|
| 185 |
+
"‹",
|
| 186 |
+
"›",
|
| 187 |
+
"※",
|
| 188 |
+
"‼",
|
| 189 |
+
"‽",
|
| 190 |
+
"‾",
|
| 191 |
+
"−",
|
| 192 |
+
"₤",
|
| 193 |
+
"₡",
|
| 194 |
+
"₹",
|
| 195 |
+
"₽",
|
| 196 |
+
"₴",
|
| 197 |
+
"₿",
|
| 198 |
+
"¢",
|
| 199 |
+
"€",
|
| 200 |
+
"£",
|
| 201 |
+
"¥",
|
| 202 |
+
"Ⅰ",
|
| 203 |
+
"Ⅱ",
|
| 204 |
+
"Ⅲ",
|
| 205 |
+
"Ⅳ",
|
| 206 |
+
"Ⅴ",
|
| 207 |
+
"Ⅵ",
|
| 208 |
+
"Ⅶ",
|
| 209 |
+
"Ⅷ",
|
| 210 |
+
"Ⅸ",
|
| 211 |
+
"Ⅹ",
|
| 212 |
+
"Ⅺ",
|
| 213 |
+
"Ⅻ",
|
| 214 |
+
"ⅰ",
|
| 215 |
+
"ⅱ",
|
| 216 |
+
"ⅲ",
|
| 217 |
+
"ⅳ",
|
| 218 |
+
"ⅴ",
|
| 219 |
+
"ⅵ",
|
| 220 |
+
"ⅶ",
|
| 221 |
+
"ⅷ",
|
| 222 |
+
"ⅸ",
|
| 223 |
+
"ⅹ",
|
| 224 |
+
"ⅺ",
|
| 225 |
+
"ⅻ",
|
| 226 |
+
"➀",
|
| 227 |
+
"➁",
|
| 228 |
+
"➂",
|
| 229 |
+
"➃",
|
| 230 |
+
"➄",
|
| 231 |
+
"➅",
|
| 232 |
+
"➆",
|
| 233 |
+
"➇",
|
| 234 |
+
"➈",
|
| 235 |
+
"➉",
|
| 236 |
+
"➊",
|
| 237 |
+
"➋",
|
| 238 |
+
"➌",
|
| 239 |
+
"➍",
|
| 240 |
+
"➎",
|
| 241 |
+
"➏",
|
| 242 |
+
"➐",
|
| 243 |
+
"➑",
|
| 244 |
+
"➒",
|
| 245 |
+
"➓",
|
| 246 |
+
"❶",
|
| 247 |
+
"❷",
|
| 248 |
+
"❸",
|
| 249 |
+
"❹",
|
| 250 |
+
"❺",
|
| 251 |
+
"❻",
|
| 252 |
+
"❼",
|
| 253 |
+
"❽",
|
| 254 |
+
"❾",
|
| 255 |
+
"❿",
|
| 256 |
+
"①",
|
| 257 |
+
"②",
|
| 258 |
+
"③",
|
| 259 |
+
"④",
|
| 260 |
+
"⑤",
|
| 261 |
+
"⑥",
|
| 262 |
+
"⑦",
|
| 263 |
+
"⑧",
|
| 264 |
+
"⑨",
|
| 265 |
+
"⑩",
|
| 266 |
+
"↑",
|
| 267 |
+
"→",
|
| 268 |
+
"↓",
|
| 269 |
+
"↕",
|
| 270 |
+
"←",
|
| 271 |
+
"↔",
|
| 272 |
+
"⇒",
|
| 273 |
+
"⇐",
|
| 274 |
+
"⇔",
|
| 275 |
+
"∀",
|
| 276 |
+
"∃",
|
| 277 |
+
"∄",
|
| 278 |
+
"∴",
|
| 279 |
+
"∵",
|
| 280 |
+
"∝",
|
| 281 |
+
"∞",
|
| 282 |
+
"∩",
|
| 283 |
+
"∪",
|
| 284 |
+
"∂",
|
| 285 |
+
"∫",
|
| 286 |
+
"∬",
|
| 287 |
+
"∭",
|
| 288 |
+
"∮",
|
| 289 |
+
"∯",
|
| 290 |
+
"∰",
|
| 291 |
+
"∑",
|
| 292 |
+
"∏",
|
| 293 |
+
"√",
|
| 294 |
+
"∛",
|
| 295 |
+
"∜",
|
| 296 |
+
"∱",
|
| 297 |
+
"∲",
|
| 298 |
+
"∳",
|
| 299 |
+
"∶",
|
| 300 |
+
"∷",
|
| 301 |
+
"∼",
|
| 302 |
+
"∖",
|
| 303 |
+
"∗",
|
| 304 |
+
"≈",
|
| 305 |
+
"≠",
|
| 306 |
+
"≡",
|
| 307 |
+
"≤",
|
| 308 |
+
"≥",
|
| 309 |
+
"⊂",
|
| 310 |
+
"⊃",
|
| 311 |
+
"⊥",
|
| 312 |
+
"⊾",
|
| 313 |
+
"⊿",
|
| 314 |
+
"□",
|
| 315 |
+
"∥",
|
| 316 |
+
"∋",
|
| 317 |
+
"ƒ",
|
| 318 |
+
"′",
|
| 319 |
+
"″",
|
| 320 |
+
"À",
|
| 321 |
+
"Á",
|
| 322 |
+
"Â",
|
| 323 |
+
"Ã",
|
| 324 |
+
"Ä",
|
| 325 |
+
"Å",
|
| 326 |
+
"Æ",
|
| 327 |
+
"Ç",
|
| 328 |
+
"È",
|
| 329 |
+
"É",
|
| 330 |
+
"Ê",
|
| 331 |
+
"Ë",
|
| 332 |
+
"Ì",
|
| 333 |
+
"Í",
|
| 334 |
+
"Î",
|
| 335 |
+
"Ï",
|
| 336 |
+
"Ð",
|
| 337 |
+
"Ñ",
|
| 338 |
+
"Ò",
|
| 339 |
+
"Ó",
|
| 340 |
+
"Ô",
|
| 341 |
+
"Õ",
|
| 342 |
+
"Ö",
|
| 343 |
+
"Ø",
|
| 344 |
+
"Ù",
|
| 345 |
+
"Ú",
|
| 346 |
+
"Û",
|
| 347 |
+
"Ü",
|
| 348 |
+
"Ý",
|
| 349 |
+
"Þ",
|
| 350 |
+
"à",
|
| 351 |
+
"á",
|
| 352 |
+
"â",
|
| 353 |
+
"ã",
|
| 354 |
+
"ä",
|
| 355 |
+
"å",
|
| 356 |
+
"æ",
|
| 357 |
+
"ç",
|
| 358 |
+
"è",
|
| 359 |
+
"é",
|
| 360 |
+
"ê",
|
| 361 |
+
"ë",
|
| 362 |
+
"ì",
|
| 363 |
+
"í",
|
| 364 |
+
"î",
|
| 365 |
+
"ï",
|
| 366 |
+
"ð",
|
| 367 |
+
"ñ",
|
| 368 |
+
"ò",
|
| 369 |
+
"ó",
|
| 370 |
+
"ô",
|
| 371 |
+
"õ",
|
| 372 |
+
"ö",
|
| 373 |
+
"ø",
|
| 374 |
+
"ù",
|
| 375 |
+
"ú",
|
| 376 |
+
"û",
|
| 377 |
+
"ü",
|
| 378 |
+
"ý",
|
| 379 |
+
"þ",
|
| 380 |
+
"ÿ",
|
| 381 |
+
"Α",
|
| 382 |
+
"Β",
|
| 383 |
+
"Γ",
|
| 384 |
+
"Δ",
|
| 385 |
+
"Ε",
|
| 386 |
+
"Ζ",
|
| 387 |
+
"Η",
|
| 388 |
+
"Θ",
|
| 389 |
+
"Ι",
|
| 390 |
+
"Κ",
|
| 391 |
+
"Λ",
|
| 392 |
+
"Μ",
|
| 393 |
+
"Ν",
|
| 394 |
+
"Ξ",
|
| 395 |
+
"Ο",
|
| 396 |
+
"Π",
|
| 397 |
+
"Ρ",
|
| 398 |
+
"Σ",
|
| 399 |
+
"Τ",
|
| 400 |
+
"Υ",
|
| 401 |
+
"Φ",
|
| 402 |
+
"Χ",
|
| 403 |
+
"Ψ",
|
| 404 |
+
"Ω",
|
| 405 |
+
"α",
|
| 406 |
+
"β",
|
| 407 |
+
"γ",
|
| 408 |
+
"δ",
|
| 409 |
+
"ε",
|
| 410 |
+
"ζ",
|
| 411 |
+
"η",
|
| 412 |
+
"θ",
|
| 413 |
+
"ι",
|
| 414 |
+
"κ",
|
| 415 |
+
"λ",
|
| 416 |
+
"μ",
|
| 417 |
+
"ν",
|
| 418 |
+
"ξ",
|
| 419 |
+
"ο",
|
| 420 |
+
"π",
|
| 421 |
+
"ρ",
|
| 422 |
+
"σ",
|
| 423 |
+
"ς",
|
| 424 |
+
"τ",
|
| 425 |
+
"υ",
|
| 426 |
+
"φ",
|
| 427 |
+
"χ",
|
| 428 |
+
"ψ",
|
| 429 |
+
"ω",
|
| 430 |
+
"Å",
|
| 431 |
+
"ℏ",
|
| 432 |
+
"⌀",
|
| 433 |
+
"⍺",
|
| 434 |
+
"⍵",
|
| 435 |
+
"𝑢",
|
| 436 |
+
"𝜓",
|
| 437 |
+
"०",
|
| 438 |
+
"‥",
|
| 439 |
+
"︽",
|
| 440 |
+
"﹥",
|
| 441 |
+
"•",
|
| 442 |
+
"÷",
|
| 443 |
+
"∕",
|
| 444 |
+
"∙",
|
| 445 |
+
"⋅",
|
| 446 |
+
"·",
|
| 447 |
+
"±",
|
| 448 |
+
"∓",
|
| 449 |
+
"∟",
|
| 450 |
+
"∠",
|
| 451 |
+
"∡",
|
| 452 |
+
"∢",
|
| 453 |
+
"℧",
|
| 454 |
+
"☺",
|
| 455 |
+
" "
|
| 456 |
+
]
|
| 457 |
+
}
|
formula/.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
formula/FORMULA_MODEL_SUMMARY.md
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 7 |
+
**Type**: Encoder-Decoder Vision-Language Model
|
| 8 |
+
**Model Size**: 694 MB (PyTorch safetensors)
|
| 9 |
+
**Total Parameters**: 181,896,960 (~182M)
|
| 10 |
+
**Total Weight Tensors**: 398
|
| 11 |
+
**Total Module Instances**: 279
|
| 12 |
+
**Unique Module Types**: 20
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## Model Architecture
|
| 17 |
+
|
| 18 |
+
### High-Level Structure
|
| 19 |
+
|
| 20 |
+
```
|
| 21 |
+
Input Image (3, 768, 768)
|
| 22 |
+
↓
|
| 23 |
+
[Image Preprocessing] → Resize, Normalize, Pad
|
| 24 |
+
↓
|
| 25 |
+
[Vision Encoder] → Patch Embedding + Transformer Layers
|
| 26 |
+
↓
|
| 27 |
+
[Neck + Multi-Modal Projector] → Feature projection to text space
|
| 28 |
+
↓
|
| 29 |
+
[Text Decoder] → Transformer decoder with cross-attention
|
| 30 |
+
↓
|
| 31 |
+
[Language Modeling Head] → Token logits (vocab_size=50000)
|
| 32 |
+
↓
|
| 33 |
+
Output: LaTeX formula tokens
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## Vision Encoder (Image Understanding)
|
| 39 |
+
|
| 40 |
+
### Configuration
|
| 41 |
+
| Parameter | Value |
|
| 42 |
+
|-----------|-------|
|
| 43 |
+
| Image Size | 768 x 768 |
|
| 44 |
+
| Patch Size | 16 x 16 |
|
| 45 |
+
| Number of Patches | (768/16)² = 2304 patches |
|
| 46 |
+
| Input Channels | 3 (RGB) |
|
| 47 |
+
| Hidden Size | 768 |
|
| 48 |
+
| Output Channels | 256 (post-conv) |
|
| 49 |
+
| Number of Layers | 12 |
|
| 50 |
+
| Attention Heads | 12 |
|
| 51 |
+
| MLP Dimension | 3072 |
|
| 52 |
+
| Global Attention Indexes | [2, 5, 8, 11] |
|
| 53 |
+
| Window Size | 14 |
|
| 54 |
+
| Position Encoding | Absolute + Relative |
|
| 55 |
+
| QKV Bias | True |
|
| 56 |
+
|
| 57 |
+
### Components
|
| 58 |
+
|
| 59 |
+
1. **Patch Embedding**
|
| 60 |
+
- `model.encoder.patch_embed.projection.weight`: (768, 3, 16, 16)
|
| 61 |
+
- Conv2d layer converting patches to embeddings
|
| 62 |
+
|
| 63 |
+
2. **Position Embedding**
|
| 64 |
+
- `model.encoder.pos_embed`: Learnable position embeddings
|
| 65 |
+
|
| 66 |
+
3. **Neck (Post-Conv)**
|
| 67 |
+
- `model.encoder.neck.conv1.weight`: First conv layer
|
| 68 |
+
- `model.encoder.neck.conv2.weight`: Second conv layer
|
| 69 |
+
- `model.encoder.neck.layer_norm1.*`: First layer norm
|
| 70 |
+
- `model.encoder.neck.layer_norm2.*`: Second layer norm
|
| 71 |
+
- Output channels: 256 → 512 → 1024
|
| 72 |
+
|
| 73 |
+
4. **Multi-Modal Projector**
|
| 74 |
+
- `model.encoder.multi_modal_projector.linear_1.*`: (1024, 1024)
|
| 75 |
+
- `model.encoder.multi_modal_projector.linear_2.*`: Projects to text dimension (512)
|
| 76 |
+
- `model.encoder.multi_modal_projector.conv1.weight`: Conv projection
|
| 77 |
+
- `model.encoder.multi_modal_projector.conv2.weight`: Conv projection
|
| 78 |
+
|
| 79 |
+
5. **Transformer Layers (12 layers)**
|
| 80 |
+
Each layer contains:
|
| 81 |
+
- `attn.qkv.weight/bias`: Fused QKV projection (2304 = 3*768)
|
| 82 |
+
- `attn.proj.weight/bias`: Output projection
|
| 83 |
+
- `attn.rel_pos_h/w`: Relative position encodings
|
| 84 |
+
- `mlp.lin1.weight/bias`: First linear (3072)
|
| 85 |
+
- `mlp.lin2.weight/bias`: Second linear (768)
|
| 86 |
+
- `layer_norm1.*`: Pre-attention norm
|
| 87 |
+
- `layer_norm2.*`: Pre-MLP norm
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## Text Decoder (LaTeX Generation)
|
| 92 |
+
|
| 93 |
+
### Configuration
|
| 94 |
+
| Parameter | Value |
|
| 95 |
+
|-----------|-------|
|
| 96 |
+
| Model Type | Transformer Decoder |
|
| 97 |
+
| Hidden Size | 512 |
|
| 98 |
+
| Vocab Size | 50000 |
|
| 99 |
+
| Number of Layers | 8 |
|
| 100 |
+
| Attention Heads | 16 |
|
| 101 |
+
| FFN Dimension | 2048 |
|
| 102 |
+
| Max Position Embeddings | 2560 |
|
| 103 |
+
| Dropout | 0.1 |
|
| 104 |
+
| Activation | GELU |
|
| 105 |
+
| Scale Embedding | True |
|
| 106 |
+
| Tie Word Embeddings | False |
|
| 107 |
+
|
| 108 |
+
### Special Tokens
|
| 109 |
+
| Token ID | Token | Description |
|
| 110 |
+
|----------|-------|-------------|
|
| 111 |
+
| 0 | `<s>` | BOS (Begin of Sequence) |
|
| 112 |
+
| 1 | `<pad>` | Padding |
|
| 113 |
+
| 2 | `</s>` | EOS (End of Sequence) |
|
| 114 |
+
| 3 | `<unk>` | Unknown |
|
| 115 |
+
| 4 | `[START_REF]` | Start reference |
|
| 116 |
+
| 5 | `[END_REF]` | End reference |
|
| 117 |
+
| 6 | `[IMAGE]` | Image token |
|
| 118 |
+
| 7 | `<fragments>` | Start fragments |
|
| 119 |
+
| 8 | `</fragments>` | End fragments |
|
| 120 |
+
| 9 | `<work>` | Start work |
|
| 121 |
+
| 10 | `</work>` | End work |
|
| 122 |
+
| 11 | `[START_SUP]` | Start superscript |
|
| 123 |
+
| 12 | `[END_SUP]` | End superscript |
|
| 124 |
+
| ... | ... | More special tokens for LaTeX structure |
|
| 125 |
+
|
| 126 |
+
### Components
|
| 127 |
+
|
| 128 |
+
1. **Token Embedding**
|
| 129 |
+
- `model.decoder.embed_tokens.weight`: (50000, 512)
|
| 130 |
+
|
| 131 |
+
2. **Position Embedding**
|
| 132 |
+
- `model.decoder.embed_positions.weight`: Positional encodings
|
| 133 |
+
|
| 134 |
+
3. **Layer Norm Embedding**
|
| 135 |
+
- `model.decoder.layernorm_embedding.*`: Input embedding normalization
|
| 136 |
+
|
| 137 |
+
4. **Decoder Layers (8 layers)**
|
| 138 |
+
Each layer contains:
|
| 139 |
+
- `self_attn.q_proj/k_proj/v_proj.*`: Self-attention projections
|
| 140 |
+
- `self_attn.out_proj.*`: Self-attention output
|
| 141 |
+
- `self_attn_layer_norm.*`: Pre-self-attention norm
|
| 142 |
+
- `encoder_attn.q_proj/k_proj/v_proj.*`: Cross-attention (to encoder output)
|
| 143 |
+
- `encoder_attn.out_proj.*`: Cross-attention output
|
| 144 |
+
- `encoder_attn_layer_norm.*`: Pre-cross-attention norm
|
| 145 |
+
- `fc1.*`: First FFN linear (2048)
|
| 146 |
+
- `fc2.*`: Second FFN linear (512)
|
| 147 |
+
- `final_layer_norm.*`: Pre-FFN norm
|
| 148 |
+
|
| 149 |
+
5. **Final Layer Norm**
|
| 150 |
+
- `model.decoder.layer_norm.*`: Output normalization
|
| 151 |
+
|
| 152 |
+
6. **Language Modeling Head**
|
| 153 |
+
- `lm_head.weight`: (50000, 512) - Projects to vocabulary logits
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
+
|
| 157 |
+
## Image Preprocessing
|
| 158 |
+
|
| 159 |
+
### Configuration (from `processor_config.json`)
|
| 160 |
+
| Parameter | Value |
|
| 161 |
+
|-----------|-------|
|
| 162 |
+
| Image Size | 768 x 768 |
|
| 163 |
+
| Resample Method | Bicubic (2) |
|
| 164 |
+
| Do Resize | True |
|
| 165 |
+
| Do Rescale | True |
|
| 166 |
+
| Do Normalize | True |
|
| 167 |
+
| Do Pad | True |
|
| 168 |
+
| Do Crop Margin | True |
|
| 169 |
+
| Do Align Long Axis | False |
|
| 170 |
+
| Do Thumbnail | True |
|
| 171 |
+
| Image Mean | [0.7931, 0.7931, 0.7931] |
|
| 172 |
+
| Image Std | [0.1738, 0.1738, 0.1738] |
|
| 173 |
+
|
| 174 |
+
### Preprocessing Pipeline
|
| 175 |
+
1. **Thumbnail**: Resize maintaining aspect ratio
|
| 176 |
+
2. **Crop Margin**: Remove white margins around formula
|
| 177 |
+
3. **Resize**: Resize to 768 x 768
|
| 178 |
+
4. **Rescale**: Scale pixel values to [0, 1]
|
| 179 |
+
5. **Normalize**: Apply mean/std normalization
|
| 180 |
+
6. **Pad**: Pad to target size if needed
|
| 181 |
+
|
| 182 |
+
---
|
| 183 |
+
|
| 184 |
+
## Key Tensor Shapes
|
| 185 |
+
|
| 186 |
+
| Component | Tensor | Shape |
|
| 187 |
+
|-----------|--------|-------|
|
| 188 |
+
| Patch Embedding | `model.encoder.patch_embed.projection.weight` | (768, 3, 16, 16) |
|
| 189 |
+
| QKV Projection | `model.encoder.layers.0.attn.qkv.weight` | (2304, 768) |
|
| 190 |
+
| Token Embedding | `model.decoder.embed_tokens.weight` | (50000, 512) |
|
| 191 |
+
| Projector | `model.encoder.multi_modal_projector.linear_1.weight` | (1024, 1024) |
|
| 192 |
+
| LM Head | `lm_head.weight` | (50000, 512) |
|
| 193 |
+
|
| 194 |
+
---
|
| 195 |
+
|
| 196 |
+
## Model Tree Structure
|
| 197 |
+
|
| 198 |
+
```
|
| 199 |
+
PPFormulaNetForConditionalGeneration
|
| 200 |
+
├── model
|
| 201 |
+
│ ├── encoder (Vision Encoder)
|
| 202 |
+
│ │ ├── patch_embed
|
| 203 |
+
│ │ │ └── projection (Conv2d)
|
| 204 |
+
│ │ ├── pos_embed (Learnable)
|
| 205 |
+
│ │ ├── neck
|
| 206 |
+
│ │ │ ├── conv1
|
| 207 |
+
│ │ │ ├── conv2
|
| 208 |
+
│ │ │ ├── layer_norm1
|
| 209 |
+
│ │ │ └── layer_norm2
|
| 210 |
+
│ │ ├── multi_modal_projector
|
| 211 |
+
│ │ │ ├── linear_1
|
| 212 |
+
│ │ │ ├── linear_2
|
| 213 |
+
│ │ │ ├── conv1
|
| 214 |
+
│ │ │ └── conv2
|
| 215 |
+
│ │ └── layers (12 Transformer layers)
|
| 216 |
+
│ │ └── [0-11]
|
| 217 |
+
│ │ ├── attn
|
| 218 |
+
│ │ │ ├── qkv
|
| 219 |
+
│ │ │ ├── proj
|
| 220 |
+
│ │ │ ├── rel_pos_h
|
| 221 |
+
│ │ │ └── rel_pos_w
|
| 222 |
+
│ │ ├── mlp
|
| 223 |
+
│ │ │ ├── lin1
|
| 224 |
+
│ │ │ └── lin2
|
| 225 |
+
│ │ ├── layer_norm1
|
| 226 |
+
│ │ └── layer_norm2
|
| 227 |
+
│ └── decoder (Text Decoder)
|
| 228 |
+
│ ├── embed_tokens
|
| 229 |
+
│ ├── embed_positions
|
| 230 |
+
│ ├── layernorm_embedding
|
| 231 |
+
│ ├── layers (8 Transformer layers)
|
| 232 |
+
│ │ └── [0-7]
|
| 233 |
+
│ │ ├── self_attn
|
| 234 |
+
│ │ │ ├── q_proj
|
| 235 |
+
│ │ │ ├── k_proj
|
| 236 |
+
│ │ │ ├── v_proj
|
| 237 |
+
│ │ │ └── out_proj
|
| 238 |
+
│ │ ├── self_attn_layer_norm
|
| 239 |
+
│ │ ├── encoder_attn
|
| 240 |
+
│ │ │ ├── q_proj
|
| 241 |
+
│ │ │ ├── k_proj
|
| 242 |
+
│ │ │ ├── v_proj
|
| 243 |
+
│ │ │ └── out_proj
|
| 244 |
+
│ │ ├── encoder_attn_layer_norm
|
| 245 |
+
│ │ ├── fc1
|
| 246 |
+
│ │ ├── fc2
|
| 247 |
+
│ │ └── final_layer_norm
|
| 248 |
+
│ └── layer_norm
|
| 249 |
+
└── lm_head (Linear)
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
---
|
| 253 |
+
|
| 254 |
+
## Inference Usage
|
| 255 |
+
|
| 256 |
+
### HuggingFace Transformers
|
| 257 |
+
|
| 258 |
+
```python
|
| 259 |
+
from PIL import Image
|
| 260 |
+
from transformers import AutoProcessor, PPFormulaNetForConditionalGeneration
|
| 261 |
+
|
| 262 |
+
# Load model and processor
|
| 263 |
+
model_path = "model/formula"
|
| 264 |
+
model = PPFormulaNetForConditionalGeneration.from_pretrained(model_path)
|
| 265 |
+
processor = AutoProcessor.from_pretrained(model_path)
|
| 266 |
+
|
| 267 |
+
# Preprocess image
|
| 268 |
+
image = Image.open("formula.png").convert("RGB")
|
| 269 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 270 |
+
|
| 271 |
+
# Generate LaTeX
|
| 272 |
+
outputs = model.generate(**inputs)
|
| 273 |
+
result = processor.post_process(outputs)
|
| 274 |
+
print(result) # LaTeX string
|
| 275 |
+
```
|
| 276 |
+
|
| 277 |
+
### Key Points
|
| 278 |
+
- Use `model.generate()` for autoregressive decoding (inference mode)
|
| 279 |
+
- Use `model.forward()` only for training (requires decoder input_ids)
|
| 280 |
+
- The processor handles image preprocessing and text post-processing
|
| 281 |
+
|
| 282 |
+
### Decoding Strategy
|
| 283 |
+
**Default: Greedy Decoding** (beam_size=1)
|
| 284 |
+
- `num_beams`: 1 (default)
|
| 285 |
+
- `do_sample`: False (default)
|
| 286 |
+
- `max_length`: 1537 tokens
|
| 287 |
+
|
| 288 |
+
To enable beam search for better quality:
|
| 289 |
+
```python
|
| 290 |
+
outputs = model.generate(**inputs, num_beams=5, early_stopping=True)
|
| 291 |
+
```
|
| 292 |
+
|
| 293 |
+
Common generation parameters:
|
| 294 |
+
- `num_beams`: Number of beams for beam search (default=1)
|
| 295 |
+
- `max_length`: Maximum sequence length (default=1537)
|
| 296 |
+
- `early_stopping`: Stop when all beams reach EOS (default=False)
|
| 297 |
+
- `length_penalty`: Penalty for longer sequences (default=1.0)
|
| 298 |
+
- `do_sample`: Enable sampling (default=False)
|
| 299 |
+
- `temperature`: Sampling temperature (default=1.0)
|
| 300 |
+
- `top_k`: Top-k sampling (default=50)
|
| 301 |
+
- `top_p`: Nucleus sampling (default=1.0)
|
| 302 |
+
|
| 303 |
+
---
|
| 304 |
+
|
| 305 |
+
## Porting Considerations for MLX
|
| 306 |
+
|
| 307 |
+
### Key Challenges
|
| 308 |
+
|
| 309 |
+
1. **Relative Position Encoding**: The vision encoder uses both absolute and relative position encodings (`rel_pos_h`, `rel_pos_w`). MLX's attention mechanism may need custom implementation.
|
| 310 |
+
|
| 311 |
+
2. **Global Attention**: Layers at indexes [2, 5, 8, 11] use global attention. This may require special handling.
|
| 312 |
+
|
| 313 |
+
3. **Window Attention**: Window size of 14 suggests window-based attention (similar to Swin Transformer).
|
| 314 |
+
|
| 315 |
+
4. **Cross-Attention**: The decoder has cross-attention to encoder outputs, requiring careful memory management.
|
| 316 |
+
|
| 317 |
+
5. **Autoregressive Generation**: The decoder generates tokens one at a time, which may be slow on MLX without optimization.
|
| 318 |
+
|
| 319 |
+
6. **Large Vocabulary**: 50,000 vocab size means the LM head is large (50000 x 512).
|
| 320 |
+
|
| 321 |
+
### MLX Module Structure
|
| 322 |
+
|
| 323 |
+
The MLX implementation would need:
|
| 324 |
+
- `PPFormulaNetVisionEncoder`: Vision encoder with patch embedding and transformer layers
|
| 325 |
+
- `PPFormulaNetNeck`: Post-conv layers for feature refinement
|
| 326 |
+
- `PPFormulaNetMultiModalProjector`: Projects vision features to text space
|
| 327 |
+
- `PPFormulaNetDecoder`: Transformer decoder with self and cross attention
|
| 328 |
+
- `PPFormulaNetLMHead`: Linear layer for vocabulary projection
|
| 329 |
+
- `PPFormulaNetModel`: Combined model
|
| 330 |
+
- `PPFormulaNetForConditionalGeneration`: Root model with generation support
|
| 331 |
+
|
| 332 |
+
---
|
| 333 |
+
|
| 334 |
+
## Module Types Breakdown
|
| 335 |
+
|
| 336 |
+
| Module Type | Count | Description |
|
| 337 |
+
|-------------|-------|-------------|
|
| 338 |
+
| Linear | 131 | Linear projection layers |
|
| 339 |
+
| LayerNorm | 50 | Layer normalization layers |
|
| 340 |
+
| GELUActivation | 20 | GELU activation functions |
|
| 341 |
+
| PPFormulaNetAttention | 16 | Attention mechanisms (12 vision + 4 decoder cross-attention) |
|
| 342 |
+
| PPFormulaNetVisionLayer | 12 | Vision transformer encoder layers |
|
| 343 |
+
| PPFormulaNetVisionAttention | 12 | Vision-specific attention with relative position encoding |
|
| 344 |
+
| PPFormulaNetMLPBlock | 12 | MLP blocks in vision encoder |
|
| 345 |
+
| PPFormulaNetDecoderLayer | 8 | Text decoder layers |
|
| 346 |
+
| Conv2d | 5 | Convolutional layers (patch embed + neck + projector) |
|
| 347 |
+
| ModuleList | 2 | Module lists for repeated layers |
|
| 348 |
+
| PPFormulaNetLayerNorm | 2 | Custom layer norm implementations |
|
| 349 |
+
| PPFormulaNetForConditionalGeneration | 1 | Root model class |
|
| 350 |
+
| PPFormulaNetModel | 1 | Core model (encoder + decoder) |
|
| 351 |
+
| PPFormulaNetTextModel | 1 | Text decoder wrapper |
|
| 352 |
+
| PPFormulaNetScaledWordEmbedding | 1 | Scaled word embedding layer |
|
| 353 |
+
| PPFormulaNetLearnedPositionalEmbedding | 1 | Learnable position embeddings |
|
| 354 |
+
| PPFormulaNetVisionModel | 1 | Vision encoder wrapper |
|
| 355 |
+
| PPFormulaNetPatchEmbeddings | 1 | Patch embedding layer |
|
| 356 |
+
| PPFormulaNetVisionNeck | 1 | Vision neck (post-conv) |
|
| 357 |
+
| PPFormulaNetMultiModalProjector | 1 | Multi-modal projection layer |
|
| 358 |
+
|
| 359 |
+
---
|
| 360 |
+
|
| 361 |
+
## Files in `model/formula/`
|
| 362 |
+
|
| 363 |
+
| File | Description |
|
| 364 |
+
|------|-------------|
|
| 365 |
+
| `model.safetensors` | PyTorch weights (694 MB, 398 tensors) |
|
| 366 |
+
| `config.json` | Model architecture configuration |
|
| 367 |
+
| `processor_config.json` | Image preprocessing configuration |
|
| 368 |
+
| `tokenizer_config.json` | Tokenizer special tokens and settings |
|
| 369 |
+
| `tokenizer.json` | Tokenizer vocabulary |
|
| 370 |
+
| `generation_config.json` | Generation parameters |
|
| 371 |
+
| `inference.yml` | Inference configuration |
|
| 372 |
+
| `README.md` | Model documentation (Apache 2.0 license) |
|
| 373 |
+
| `formula_model_tree.json` | Generated model tree structure |
|
| 374 |
+
|
| 375 |
+
---
|
| 376 |
+
|
| 377 |
+
## References
|
| 378 |
+
|
| 379 |
+
- HuggingFace Model: `PaddlePaddle/PP-FormulaNet_plus-L_safetensors`
|
| 380 |
+
- Original Paper: PP-FormulaNet (PaddlePaddle)
|
| 381 |
+
- Transformers Class: `PPFormulaNetForConditionalGeneration`
|
| 382 |
+
- Processor Class: `PPFormulaNetProcessor`
|
formula/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
formula/config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "pp_formulanet",
|
| 3 |
+
"text_config": {
|
| 4 |
+
"activation_dropout": 0.0,
|
| 5 |
+
"activation_function": "gelu",
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"d_model": 512,
|
| 9 |
+
"decoder_attention_heads": 16,
|
| 10 |
+
"decoder_ffn_dim": 2048,
|
| 11 |
+
"decoder_layerdrop": 0.0,
|
| 12 |
+
"decoder_layers": 8,
|
| 13 |
+
"dropout": 0.1,
|
| 14 |
+
"encoder_attention_heads": 16,
|
| 15 |
+
"encoder_layers": 12,
|
| 16 |
+
"eos_token_id": 2,
|
| 17 |
+
"forced_eos_token_id": 2,
|
| 18 |
+
"init_std": 0.02,
|
| 19 |
+
"max_position_embeddings": 2560,
|
| 20 |
+
"num_hidden_layers": 12,
|
| 21 |
+
"pad_token_id": 1,
|
| 22 |
+
"scale_embedding": true,
|
| 23 |
+
"tie_word_embeddings": false,
|
| 24 |
+
"vocab_size": 50000
|
| 25 |
+
},
|
| 26 |
+
"vision_config": {
|
| 27 |
+
"image_size": 768,
|
| 28 |
+
"output_channels":256,
|
| 29 |
+
"num_channels":3,
|
| 30 |
+
"patch_size":16,
|
| 31 |
+
"hidden_act":"gelu",
|
| 32 |
+
"layer_norm_eps":1e-6,
|
| 33 |
+
"attention_dropout":0.0,
|
| 34 |
+
"qkv_bias":true,
|
| 35 |
+
"use_abs_pos":true,
|
| 36 |
+
"use_rel_pos":true,
|
| 37 |
+
"window_size":14,
|
| 38 |
+
"hidden_size": 768,
|
| 39 |
+
"num_hidden_layers": 12,
|
| 40 |
+
"num_attention_heads": 12,
|
| 41 |
+
"global_attn_indexes": [2, 5, 8, 11],
|
| 42 |
+
"mlp_dim": 3072,
|
| 43 |
+
"post_conv_in_channels": 256,
|
| 44 |
+
"post_conv_mid_channels": 512,
|
| 45 |
+
"post_conv_out_channels": 1024
|
| 46 |
+
}
|
| 47 |
+
}
|
formula/formula_model_tree.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
formula/generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 0,
|
| 3 |
+
"eos_token_id": 2,
|
| 4 |
+
"forced_eos_token_id": 2,
|
| 5 |
+
"decoder_start_token_id": 2,
|
| 6 |
+
"max_length": 1537,
|
| 7 |
+
"pad_token_id": 1,
|
| 8 |
+
"use_cache": true
|
| 9 |
+
}
|
| 10 |
+
|
formula/inference.yml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
formula/model.mlx.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07c9d416dbecf6723ad6a970e8351dd5814d77235aa2575c693af8f98df14da3
|
| 3 |
+
size 727633061
|
formula/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:582848cf9b7066bb1cf3166ad75a476da492c3661ffa61bb7439f9fd098bde13
|
| 3 |
+
size 727633048
|
formula/processor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"do_align_long_axis": false,
|
| 4 |
+
"do_crop_margin": true,
|
| 5 |
+
"do_normalize": true,
|
| 6 |
+
"do_pad": true,
|
| 7 |
+
"do_rescale": true,
|
| 8 |
+
"do_resize": true,
|
| 9 |
+
"do_thumbnail": true,
|
| 10 |
+
"size": {
|
| 11 |
+
"height": 768,
|
| 12 |
+
"width": 768
|
| 13 |
+
},
|
| 14 |
+
"image_mean": [0.7931, 0.7931, 0.7931],
|
| 15 |
+
"image_std": [0.1738, 0.1738, 0.1738],
|
| 16 |
+
"image_processor_type": "PPFormulaNetImageProcessor",
|
| 17 |
+
"resample": 2,
|
| 18 |
+
"return_tensors": "pt"
|
| 19 |
+
},
|
| 20 |
+
"processor_class": "PPFormulaNetProcessor"
|
| 21 |
+
}
|