We’ve integrated PaddleOCR models into DeGirum PySDK, making OCR (text detection + recognition) easy to use in your applications. Reference code example can be found here: hailo_examples/examples/025_paddle_ocr.ipynb at main · DeGirum/hailo_examples
Thanks to the Hailo team for compiling the PaddleOCR models for Hailo-8 devices and providing reference implementation, as well as publishing a detailed guide on how to integrate them, which you can find here: Hailo Community Guide on PaddleOCR.
Traditionally, OCR requires a two-stage pipeline:
-
Text detection – locating text regions in the image.
-
Text recognition – reading and decoding the text within those regions.
With PySDK, these two models can be combined into a single compound model using CroppingAndClassifyingCompoundModel
. This compound model automatically takes care of:
-
Running the detection model to find text regions.
-
Cropping detected regions.
-
Passing them to the recognition model.
-
Returning unified OCR results.
This drastically simplifies what would otherwise be a multi-step process.
Example Usage
import degirum as dg, degirum_tools
# Core connection settings
inference_host_address = "@local"
zoo_url = 'degirum/hailo'
device_type = ['HAILORT/HAILO8']
# Input image
image_source = "image_path or url or numpy array"
# PaddleOCR model names
paddle_ocr_det_model_name = "paddle_ocr_detection--544x960_quant_hailort_hailo8_1"
paddle_ocr_rec_model_name = "paddle_ocr_recognition--48x320_quant_hailort_hailo8_1"
# Load detection and recognition models
paddle_ocr_text_det_model = dg.load_model(
model_name=paddle_ocr_det_model_name,
inference_host_address=inference_host_address,
zoo_url=zoo_url,
device_type=device_type
)
paddle_ocr_text_rec_model = dg.load_model(
model_name=paddle_ocr_rec_model_name,
inference_host_address=inference_host_address,
zoo_url=zoo_url,
device_type=device_type
)
# Combine into a single compound OCR model
crop_model = degirum_tools.CroppingAndClassifyingCompoundModel(
paddle_ocr_text_det_model,
paddle_ocr_text_rec_model
)
# Run inference
inference_result = crop_model(image_source)
# Display results
with degirum_tools.Display("OCR Output") as display:
display.show_image(inference_result)
Benefits of the Compound Model Approach
-
Simplified workflow: Just one model call instead of chaining manually.
-
Unified results: Detection boxes with recognized text in a single output object.
-
Flexibility: Works with any detection + classification/recognition models, not just OCR.