Skip to main content
Version: 0.10.x [Latest Beta]

Optical character recognition (OCR)

An OCR pipeline detects text regions and recognizes their content. Each detected region is a top-level InferenceResult with a bounding_box, and the recognized text is carried on its sub_results. See SimplifiedPipeline for the shared setup.

import denkflow

pipeline = denkflow.Pipeline.from_denkflow("path/to/model.denkflow", pat="YOUR-PAT")
simplified = denkflow.SimplifiedPipeline(pipeline)

results = simplified.run("path/to/image.jpg", confidence_threshold=0.5)

for image_result in results:
for r in image_result.results:
for sub in r.sub_results:
if sub.text is not None:
print(sub.text)