Image-to-Text
PaddleOCR
Safetensors
English
Chinese
pp_ocrv5_mobile_rec
OCR
PaddlePaddle
textline_recognition
Instructions to use tomsanbear/pp-ocrv5-mobile-rec with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use tomsanbear/pp-ocrv5-mobile-rec with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import TextRecognition model = TextRecognition(model_name="pp-ocrv5-mobile-rec") output = model.predict(input="path/to/image.png", batch_size=1) for res in output: res.print() res.save_to_img(save_path="./output/") res.save_to_json(save_path="./output/res.json") - Notebooks
- Google Colab
- Kaggle
| { | |
| "architecture_id": "ocr.ppocr-ctc", | |
| "bundle_id": "ocr/recognizer/ppocr-ctc", | |
| "implementation_notes": { | |
| "current_markers_decode": "argmax, collapse repeats, drop blank index 0", | |
| "embedded_config": "runtime should load preprocessor_config.json character_list as-is; do not prepend another blank token, append another space token, or depend on AXERA ppocrv5_dict.txt", | |
| "head_out_channels": 18385, | |
| "hidden_size": 120, | |
| "source_dynamic_shapes": [ | |
| [ | |
| 1, | |
| 3, | |
| 48, | |
| 160 | |
| ], | |
| [ | |
| 1, | |
| 3, | |
| 48, | |
| 320 | |
| ], | |
| [ | |
| 8, | |
| 3, | |
| 48, | |
| 3200 | |
| ] | |
| ] | |
| }, | |
| "license": "Apache-2.0", | |
| "parity_source": { | |
| "files": [ | |
| "rec_mobile_sim_static.onnx", | |
| "rec.json", | |
| "ppocrv5_dict.txt" | |
| ], | |
| "repo": "AXERA-TECH/PPOCR_v5", | |
| "revision": "2a3427a63c410ee6982250769126328ad85eb24a" | |
| }, | |
| "preprocessing": { | |
| "known_mismatches": [ | |
| "source preprocessor_config.json does not explicitly serialize image_mean or image_std; current markers keeps PP-OCR/AXERA (-0.5)/0.5 normalization until source parity fixtures confirm a change", | |
| "source preprocessor_config.json says do_convert_rgb=true while inference.yml DecodeImage uses BGR; current markers converts to RGB and then packs BGR-NCHW", | |
| "source model names the main input pixel_values in Transformers and x in Paddle inference metadata" | |
| ], | |
| "markers_legacy_compat": { | |
| "channel_order": "bgr", | |
| "input_shape": [ | |
| 1, | |
| 3, | |
| 48, | |
| 320 | |
| ], | |
| "mean_u8": [ | |
| 127.5, | |
| 127.5, | |
| 127.5 | |
| ], | |
| "output": "ctc_probabilities", | |
| "postprocess": "decode_ctc", | |
| "resize": "aspect-preserving height resize with right padding", | |
| "std_u8": [ | |
| 127.5, | |
| 127.5, | |
| 127.5 | |
| ] | |
| }, | |
| "source_inference_yml": { | |
| "decode_image_mode": "BGR", | |
| "dynamic_shapes": [ | |
| [ | |
| 1, | |
| 3, | |
| 48, | |
| 160 | |
| ], | |
| [ | |
| 1, | |
| 3, | |
| 48, | |
| 320 | |
| ], | |
| [ | |
| 8, | |
| 3, | |
| 48, | |
| 3200 | |
| ] | |
| ], | |
| "keep_keys": [ | |
| "image", | |
| "label_ctc", | |
| "label_gtc", | |
| "length", | |
| "valid_ratio" | |
| ], | |
| "paddle_input_name": "x", | |
| "rec_resize_image_shape": [ | |
| 3, | |
| 48, | |
| 320 | |
| ] | |
| }, | |
| "source_processor": { | |
| "do_convert_rgb": true, | |
| "do_normalize": true, | |
| "do_pad": true, | |
| "do_rescale": true, | |
| "do_resize": true, | |
| "max_image_width": 3200, | |
| "pad_size": { | |
| "height": 48, | |
| "width": 320 | |
| }, | |
| "size": { | |
| "height": 48, | |
| "width": 320 | |
| } | |
| } | |
| }, | |
| "provenance": { | |
| "conversion": "native safetensors copied byte-for-byte; metadata generated", | |
| "runtime_onnx": "false", | |
| "source_model_class": "PPOCRV5MobileRecForTextRecognition", | |
| "source_output": "softmax CTC probabilities, not raw logits", | |
| "source_paddle_input_name": "x", | |
| "source_transformers_input_name": "pixel_values", | |
| "source_transformers_output_name": "last_hidden_state" | |
| }, | |
| "required_files": [ | |
| { | |
| "path": "model.safetensors", | |
| "role": "weights" | |
| }, | |
| { | |
| "path": "config.json", | |
| "role": "config" | |
| }, | |
| { | |
| "path": "preprocessor_config.json", | |
| "role": "preprocessor-and-charset" | |
| }, | |
| { | |
| "path": "inference.yml", | |
| "role": "source-inference-config" | |
| }, | |
| { | |
| "path": "README.md", | |
| "role": "source-card" | |
| }, | |
| { | |
| "path": "ocr_pipeline.py", | |
| "role": "source-example" | |
| }, | |
| { | |
| "path": "tensor_map.json", | |
| "role": "tensor-map" | |
| }, | |
| { | |
| "path": "validation.json", | |
| "role": "validation" | |
| } | |
| ], | |
| "schema_version": 1, | |
| "source": { | |
| "files": [ | |
| "README.md", | |
| "config.json", | |
| "inference.yml", | |
| "model.safetensors", | |
| "ocr_pipeline.py", | |
| "preprocessor_config.json" | |
| ], | |
| "repo": "PaddlePaddle/PP-OCRv5_mobile_rec_safetensors", | |
| "revision": "485a9a9781535ad477de3b1eea5f96a2e7300d8d" | |
| }, | |
| "tensor_contract": { | |
| "inputs": [ | |
| { | |
| "aliases": [ | |
| "x" | |
| ], | |
| "dtype": "f32", | |
| "name": "pixel_values", | |
| "shape": [ | |
| "batch", | |
| 3, | |
| 48, | |
| 320 | |
| ] | |
| } | |
| ], | |
| "outputs": [ | |
| { | |
| "aliases": [ | |
| "last_hidden_state" | |
| ], | |
| "dtype": "f32", | |
| "name": "ctc_probabilities", | |
| "sequence_length": "input_width / 8 for the fixed 320-wide smoke contract", | |
| "shape": [ | |
| "batch", | |
| 40, | |
| 18385 | |
| ] | |
| } | |
| ] | |
| }, | |
| "validated_runtime": [ | |
| { | |
| "device": "cpu", | |
| "dtype": "f32" | |
| } | |
| ], | |
| "vocab": { | |
| "blank_index": 0, | |
| "blank_token": "blank", | |
| "body_size": 18383, | |
| "ctc": { | |
| "blank_index": 0, | |
| "collapse_repeated_non_blank": true, | |
| "confidence": "mean selected timestep probability", | |
| "output_kind": "softmax probabilities" | |
| }, | |
| "first_tokens": [ | |
| "blank", | |
| "\u3000", | |
| "\u4e00", | |
| "\u4e59", | |
| "\u4e8c", | |
| "\u5341", | |
| "\u4e01", | |
| "\u5382" | |
| ], | |
| "head_out_channels": 18385, | |
| "inference_body_matches": true, | |
| "inference_character_dict_size": 18383, | |
| "last_tokens": [ | |
| "\ud83d\udd61", | |
| "\ud83d\udd62", | |
| "\ud83d\udd63", | |
| "\ud83d\udd64", | |
| "\ud83d\udd65", | |
| "\ud83d\udd66", | |
| "\ud83d\udd67", | |
| " " | |
| ], | |
| "max_token_unicode_scalars": 5, | |
| "multi_scalar_token_count": 11, | |
| "runtime_policy": "embedded_config", | |
| "source": "preprocessor_config.json character_list", | |
| "space_token_index": 18384, | |
| "vocab_size": 18385 | |
| } | |
| } | |