PP-OCRv5mobiledet is one of the PP-OCRv5det series, the latest generation of text detection models developed by the PaddleOCR team. It aims to efficiently and accurately…
PP-OCRv5_mobile_det
This model was contributed to Hugging Face Transformers on 2026-03-13.
PP-OCRv5_mobile_det
Overview
PP-OCRv5_mobile_det is a dedicated lightweight model for text detection, focusing specifically on efficient detection and understanding of text elements in multi-language documents and natural scenes.
Model Architecture
PP-OCRv5_mobile_det is one of the PP-OCRv5_det series, the latest generation of text detection models developed by the PaddleOCR team. It aims to efficiently and accurately supports the detection of text in diverse scenarios—including handwriting, vertical, rotated, and curved text—across multiple languages such as Simplified Chinese, Traditional Chinese, English, and Japanese. Key features include robust handling of complex layouts, varying text sizes, and challenging backgrounds, making it suitable for practical applications like document analysis, license plate recognition, and scene text detection.
Usage
Single input inference
The example below demonstrates how to detect text with PP-OCRV5_Mobile_Det using the Pipeline or the AutoModel.
Pipeline
import requests
from PIL import Image
from transformers import pipeline
image = Image.open(
requests.get(
"https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/images/paddle_general_ocr_001.png", stream=True
).raw)
detector = pipeline(
task="object-detection",
model="PaddlePaddle/PP-OCRV5_mobile_det_safetensors",
device_map="auto",
)
results = detector(image)
for result in results:
print(result)
AutoModel
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForObjectDetection
model_path="PaddlePaddle/PP-OCRv5_mobile_det_safetensors"
model = AutoModelForObjectDetection.from_pretrained(model_path, device_map="auto")
image_processor = AutoImageProcessor.from_pretrained(model_path)
image = Image.open(requests.get("https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/images/paddle_general_ocr_001.png", stream=True).raw).convert("RGB")
inputs = image_processor(images=image, return_tensors="pt").to(model.device)
outputs = model(**inputs)
results = image_processor.post_process_object_detection(outputs, target_sizes=inputs["target_sizes"])
for result in results:
print(result["boxes"])
print(result["scores"])
Batched inference
Here is how you can do it with PP-OCRV5_Mobile_Det using the Pipeline or the AutoModel:
Pipeline
import requests
from PIL import Image
from transformers import pipeline
image = Image.open(
requests.get(
"https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/images/paddle_general_ocr_001.png", stream=True
).raw)
detector = pipeline(
task="object-detection",
model="PaddlePaddle/PP-OCRV5_mobile_det_safetensors",
device_map="auto",
)
results = detector([image, image])
for result in results:
print(result)
AutoModel
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForObjectDetection
model_path="PaddlePaddle/PP-OCRv5_mobile_det_safetensors"
model = AutoModelForObjectDetection.from_pretrained(model_path, device_map="auto")
image_processor = AutoImageProcessor.from_pretrained(model_path)
image = Image.open(requests.get("https://huggingface.co/datasets/hf-internal-testing/transformers-synthetic-assets/resolve/main/images/paddle_general_ocr_001.png", stream=True).raw).convert("RGB")
inputs = image_processor(images=[image, image], return_tensors="pt").to(model.device)
outputs = model(**inputs)
results = image_processor.post_process_object_detection(outputs, target_sizes=inputs["target_sizes"])
for result in results:
print(result["boxes"])
print(result["scores"])
PPOCRV5MobileDetForObjectDetection
[[autodoc]] PPOCRV5MobileDetForObjectDetection
PPOCRV5MobileDetConfig
[[autodoc]] PPOCRV5MobileDetConfig
PPOCRV5MobileDetModel
[[autodoc]] PPOCRV5MobileDetModel
Source and license
Source: Transformers documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.