FR Demo

Models

Seven models I trained: what each does, how, and what it scored. Failures included.

Text recogniser

Not shipped

Characters wrong on a font never seen (lower is better)
Mine 1.2 %
docTR 3.5 %
tesseract 11.9 %
Text recogniser networkConvolutions shrink the line image to one row, a two-way LSTM reads it, CTC gives the characters.CTC · textBiLSTM ×2conv · 1conv · 2conv ×2 · 4conv · 8conv · 16line image
Text recogniser networkConvolutions shrink the line image to one row, a two-way LSTM reads it, CTC gives the characters.CTC · textBiLSTM ×2conv · 1conv · 2conv ×2 · 4conv · 8conv · 16line image
From image columns to text with CTCThe trained recogniser reads one damaged line: one guess per column, repeated letters joined, blanks dropped.1. The image of a line, as the network gets it2. One guess per column (shade is the confidence, a dot is a blank)·R··I··Z··␣␣·BB·AA·S··MM·AA·TT·II·␣␣·11·KK··G··␣··␣··␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣··8··,··6··4···3. Repeats are joined, blanks dropped: the textRIZ␣BASMATI␣1KG␣␣␣␣␣␣␣␣␣␣␣␣␣8,64✓ the same as what was printed
From image columns to text with CTCThe trained recogniser reads one damaged line: one guess per column, repeated letters joined, blanks dropped.1. The image of a line, as the network gets it2. One guess per column (shade is the confidence, a dot is a blank)·R··I··Z··␣␣·BB·AA·S··MM·AA·TT·II·␣␣·11·KK··G··␣··␣··␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣·␣␣··8··,··6··4···3. Repeats are joined, blanks dropped: the textRIZ␣BASMATI␣1KG␣␣␣␣␣␣␣␣␣␣␣␣␣8,64✓ the same as what was printed
Task
Reads the image of one printed line. Built from scratch.
Network
CNN, BiLSTM, CTC, 1.29 million parameters
Training data
52,257 generated lines, two fonts
Loss
CTC
Optimiser
AdamW, one learning-rate cycle
Machine
Kaggle GPU, 20 min
Problem found
Trained on one font it scored 0.19 % on it and 22.6 % on another: it had memorised the font. More fonts fixed it.
Validation errorValidation error: 100.0 % → 8.6 %Validation errorepoch 1 · 100.0 %epoch 40 · 8.6 %
Validation errorValidation error: 100.0 % → 8.6 %Validation errorepoch 1 · 100.0 %epoch 40 · 8.6 %

Line detector

Failed on real receipts

Finding lines, F1 (higher is better)
Mine, generated photos 0.99
Mine, 100 real receipts 0.27
docTR, same real receipts 0.69
U-NetThe picture is shrunk then grown back; dashed links carry fine detail across.text lines244896192964824photo
U-NetThe picture is shrunk then grown back; dashed links carry fine detail across.text lines244896192964824photo
Task
Finds where the lines of text are on a photo.
Network
U-Net, 1.09 million parameters
Training data
2,383 generated damaged photos
Loss
binary cross-entropy and Dice
Optimiser
AdamW, one learning-rate cycle
Machine
Kaggle GPU
Problem found
It learned what my generator draws, not what real receipts look like.

Image restoration

Did not help

Reading error (lower is better)
After my network 9.1 %
Untouched photo 7.2 %
Simple filter 8.4 %
U-NetThe picture is shrunk then grown back; dashed links carry fine detail across.cleaned photo244896192964824photo
U-NetThe picture is shrunk then grown back; dashed links carry fine detail across.cleaned photo244896192964824photo
Task
Tries to clean a damaged photo before reading it.
Network
U-Net, 1.1 million parameters
Training data
pairs of clean and damaged versions of the same receipt
Loss
pixel difference (weighted on ink) and structural similarity (SSIM)
Optimiser
AdamW, cosine schedule
Machine
Kaggle GPU, two runs
Problem found
The picture looked cleaner but was read worse. Some training pairs did not line up.

Ticket straightening

Not shipped

Words read, 40 generated photos (higher is better)
Raw photo 32 %
After my straightening 51 %
Perfect correction 52 %
Task
Finds the receipt in a photo and flattens it.
Network
small U-Net, then four corners and a perspective correction

Product classifier

In the demo, and below

The model is downloaded on your first try, about 4 MB.

    It can be sure and wrong, so the app treats its answer as a suggestion only.

    Right category, unseen products (higher is better)
    Mine 79.6 %
    TF-IDF 81.3 %
    Both averaged 82.2 %
    Product classifier networkFive convolution widths read the abbreviation; two outputs share the same body.hidden wordscategory384max + meanconvolutions 2 to 6embedding 6440 characters
    Product classifier networkFive convolution widths read the abbreviation; two outputs share the same body.two outputs384max + meanconv 2 to 6embedding 6440 characters
    Task
    Guesses the category of an abbreviated product name.
    Network
    character CNN, 1.57 million parameters
    Training data
    61,197 abbreviations made from Open Food Facts names
    Loss
    category, plus the words hidden behind the abbreviation
    Optimiser
    AdamW, stops when validation stops improving
    Machine
    laptop processor, 54 min
    Deployment
    ONNX, 1.01 MB, in the browser
    Validation accuracyValidation accuracy: 73.2 % → 83.1 %Validation accuracyepoch 1 · 73.2 %epoch 22 · 83.1 %
    Validation accuracyValidation accuracy: 73.2 % → 83.1 %Validation accuracyepoch 1 · 73.2 %epoch 22 · 83.1 %

    Product search

    Not shipped

    Right product in the first five, of 5,654
    e5, fine-tuned 95.7 %
    e5, as published 62.7 %
    TF-IDF 79.0 %
    Task
    Finds the full product behind an abbreviation by comparing vectors.
    Network
    multilingual e5-small, fine-tuned
    Loss
    contrastive, with hard counter-examples from the same category
    Machine
    Kaggle, 2 x T4
    Limit
    The right product is always in the list, and the abbreviations are simulated.

    Reading engines

    The app reads with docTR and Llama 4 Scout, which are not mine.

    docTR · Tesseract · EasyOCR · Llama 4 Scout · multilingual-e5-small · CORD v2 · Open Food Facts

    EngineReceiptsnCharacter errorSilent errors
    doctrGenerated, damaged2009.1 %0.0 %
    easyocrGenerated, damaged20032.7 %0.5 %
    tesseractGenerated, damaged20036.8 %0.0 %
    doctrReal (CORD)10032.5 %
    easyocrReal (CORD)10033.4 %
    tesseractReal (CORD)100102.5 %