> This is the documentation for LibreYOLO 1.5.0. Current version: https://www.libreyolo.com/docs/models/pp-ocrv5

# PP-OCRv5
PP-OCRv5 is PaddleOCR's text detection and recognition pipeline: a differentiable-binarization detector locates text quads and an SVTR/CTC recognizer reads them. LibreYOLO ports it to PyTorch for two tiers.
Tasks: ocr. Install: pip install libreyolo.
Verified against LibreYOLO v1.5.0.

## Install

PP-OCRv5 needs no extra beyond the base package.

```bash
pip install libreyolo
```

## Predict

Weights download from Hugging Face on first use and are cached locally.

**Python**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibrePPOCRl-ocr.pt")
result = model(SAMPLE_IMAGE, save=True)

for text, conf in zip(result.ocr.texts, result.ocr.conf):
    print(text, float(conf))
```

**CLI**

```bash
libreyolo predict model=LibrePPOCRl-ocr.pt source=receipt.jpg save=True
```

**Quads**

```python
from libreyolo import LibreYOLO, SAMPLE_IMAGE

model = LibreYOLO("LibrePPOCRl-ocr.pt")
result = model(SAMPLE_IMAGE)

# (N, 4, 2) polygons in reading order: top-left, top-right,
# bottom-right, bottom-left. Detection quads are genuine polygons
# (rotated text), so they populate result.ocr, not result.boxes.
print(result.ocr.data.shape)
print(result.ocr.det_conf)
```

Each checkpoint bundles both stages, detection and recognition, under one
`.pt` file, with the recognition charset and pipeline defaults carried in the
checkpoint metadata. The recognizer reads Simplified and Traditional Chinese,
English, Japanese and pinyin with one dictionary. `result.ocr` is an
`OCRRegions` payload: `.data` holds the four-point polygons, `.texts` the
transcripts, `.conf` the per-region recognition score, and
`.det_conf` the detection score. Multi-image sources run sequentially:
the two-stage pipeline does not batch across images. See
[prediction](/docs/v1.5.0/predict) for sources, streaming and result handling.

## Variants

Two tiers: `t`, built on lighter PP-LCNetV3/PP-OCRv5_mobile backbones for CPU
use, and `l`, built on PP-HGNetV2 server backbones for higher accuracy. Both
tiers run detection at a fixed long-side limit and recognize crops in batches;
`rec_batch` controls how many crops go through the recognizer per forward
pass.

## Validate

`val()` measures the pipeline against a directory of images plus a
`labels/<split>.jsonl` file, or the equivalent dataset YAML, each label
listing per-image text-region polygons and their transcripts. It reports
detection hmean (IoU-matched precision/recall/F1), end-to-end F1 (hmean plus an
exact transcript match after normalization, the checkpoint's fitness metric),
and 1-NED, the mean normalized edit distance over matched pairs.

**Python**

```python
from libreyolo import LibreYOLO

model = LibreYOLO("LibrePPOCRl-ocr.pt")
metrics = model.val(data="my-dataset")

print(metrics["metrics/det_hmean"])
print(metrics["metrics/e2e_f1"])       # headline metric
print(metrics["metrics/rec_1-NED"])
```

**CLI**

```bash
libreyolo val model=LibrePPOCRl-ocr.pt data=my-dataset
```

## Export

| Task | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ocr |  |  |  |  |  |  |  |  |  |  |  |  |

A "yes" means the export is supported. An empty cell means the exporter refuses that combination.

PP-OCRv5 is a two-network pipeline, detection and recognition moving
together, not one traceable graph, and export is not implemented for it: no
format is supported yet. Fine-tune the Apache-2.0 upstream training code
directly and convert the result with `weights/convert_ppocr_weights.py` if you
need a checkpoint outside this format.

## Checkpoints

Every published weight file for this family.

| File | Input (px) | Task | Weights license |
| --- | --- | --- | --- |
| `LibrePPOCRt-ocr.pt` |  | ocr | apache-2.0 |
| `LibrePPOCRl-ocr.pt` |  | ocr | apache-2.0 |

## Licensing

Check the license on the Hugging Face repository of the specific weights you download. That repository is authoritative and licenses are not always uniform across a family. This is a description of the licenses involved, not legal advice.

- Original work: PaddleOCR (PP-OCRv5), PaddlePaddle Authors
- Upstream license: Apache-2.0
- Upstream source: https://github.com/PaddlePaddle/PaddleOCR
- LibreYOLO code: Apache-2.0
- Weights: Apache-2.0, republished at https://huggingface.co/LibreYOLO
- Interpretation: Apache-2.0 is a permissive license: the architecture, the officially released PP-OCRv5 checkpoints this port converts, and LibreYOLO's own PyTorch port may all be used, modified and redistributed, including commercially, provided the license text and attribution notices travel with any copy. It grants a patent license and places no obligation on your own application code.

## Citation

```bibtex
@misc{cui2025paddleocr30technicalreport,
      title={PaddleOCR 3.0 Technical Report}, 
      author={Cheng Cui and Ting Sun and Manhui Lin and Tingquan Gao and Yubo Zhang and Jiaxuan Liu and Xueqing Wang and Zelun Zhang and Changda Zhou and Hongen Liu and Yue Zhang and Wenyu Lv and Kui Huang and Yichao Zhang and Jing Zhang and Jun Zhang and Yi Liu and Dianhai Yu and Yanjun Ma},
      year={2025},
      eprint={2507.05595},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2507.05595}, 
}
```

Copied from https://github.com/PaddlePaddle/PaddleOCR#citation
