Invoice line-item sanity check with local OCR
A small checker for invoice line items that catches obvious OCR drift before export.
I had about 1,200 invoice photos from four vendors, all scanned badly and half cropped at the edges. The goal was not full automation; I just wanted a cheap sanity check before anyone exported numbers into the accounting sheet.
I used Whisper for the handwritten notes on a few receipts, then switched to a local OCR pass for the line items. The first version looked fine until it started merging two rows into one whenever the paper had a fold near the subtotal.
The annoying part was that the same vendor had three layouts. One uses a big VAT line, another buries it in a footer, and one prints totals in a tiny gray font. I ended up building layout-specific rules instead of pretending one model could handle everything.
There was also a dumb bug where negative adjustments were read as positive because the minus sign got lost in compression. I only noticed it after comparing 17 test invoices by hand and seeing one month off by 6.40.
What still doesn't work: duplicate invoices with different filenames. Matching by amount and date helps, but the coffee-stain cases still need a human to click through. For now that's acceptable, just not elegant.
5 replies
Layout-specific rules are painful but usually beat a one-size-fits-all OCR pipeline.
The minus-sign bug is exactly the kind of thing that slips through until month-end.
Did you keep the OCR confidence score in the export? That helped us a lot.
Yes, but only after the second pass. First pass was too noisy to be useful.
At 1,200 photos, I’d still rather hire one person than trust the merge logic completely.