AI Model Wiki

    Skip to main content
    Back to Glossary

    OCR

    Optical Character Recognition (OCR) is the process of detecting and extracting text from raster images - scanned documents, photographs, screenshots, or PDF page renders - and converting it into machine-readable character sequences. Classical OCR pipelines combined image pre-processing (binarisation, deskew), a segmentation step to isolate text regions, and a character classifier trained on labelled glyph images. Modern deep-learning OCR systems replace most of that pipeline with end-to-end Neural Networks, typically a Convolutional Neural Network encoder that extracts visual features followed by a sequence decoder (often a Transformer) that emits character probabilities.

    Think of it like a human transcriptionist reading a handwritten letter and typing it out, except the process runs in milliseconds and scales to millions of pages without fatigue.

    A minimal example using the open-source EasyOCR library:

    import easyocr
    
    reader = easyocr.Reader(["en"], gpu=True)
    results = reader.readtext("invoice_scan.jpg")
    
    for (bbox, text, confidence) in results:
        if confidence > 0.5:
            print(f"{text!r}  (conf={confidence:.2f})")
    # 'Invoice No: 10042'  (conf=0.94)
    # 'Total: $1,250.00'   (conf=0.91)
    

    Multimodal foundation models such as GPT-4o and Claude 3 have partially subsumed standalone OCR by accepting image inputs and returning transcriptions alongside semantic understanding, blurring the boundary between recognition and comprehension. Related concepts include Tokenization (converting the recognised text into model inputs), Embedding (representing extracted text for downstream tasks), Inference (the serving pipeline that runs OCR at scale), and Fine-tuning (adapting a base OCR model to domain-specific fonts or layouts such as handwriting or legal forms).

    You will encounter OCR in document-processing workflows - digitising archives, extracting data from scanned invoices, powering accessibility features for visually impaired users, and feeding raw text into downstream NLP pipelines.

    Related Courses

    AI Terminology
    Glossary