How to use

August 28, 2025 - 3 minute read - Category: Starter

How to use

Run the complete detection, script identification, and recognition pipeline with one image.

End-to-end OCR

from IndicPhotoOCR.ocr import OCR

ocr_system = OCR(verbose=False, identifier_lang="auto", device="cuda:0")
results = ocr_system.ocr("test_images/image_141.jpg")

The result is a structured list of lines, with words ordered from left to right:

[
  ["राजीव", "चौक", "मेट्रो", "स्टेशन"],
  ["Rajiv", "Chowk", "Metro", "Station"]
]

For CPU inference, use device="cpu". For batch inference, pass batch_size=32.

Individual modules

  • detect(image_path) finds text regions.
  • identify(image_path) predicts a cropped word's script.
  • recognise(image_path, language) reads a cropped word.
  • ocr(image_path) runs the complete pipeline.

See the repository usage guide for evaluation scripts and advanced options.