Lab 02 · Documents: receipt and invoice field extraction

A fine-tune of microsoft/layoutlm-base-uncased (revision 30e3cdd39c11f09757b0fcf7598533d05052acef, MIT) that tags each OCR word of a receipt or invoice with the field it belongs to. It runs in the visitor's browser through ONNX Runtime Web in the Documents lab of The Collection, a personal portfolio.

Trained by labs-training/documents/train.py at commit 4926c84988395d904598cf0ef902717f95d44d63, seed 20261015, clean tree. Exported by export.py (exporter torchscript, opset 17).

Data

  • CORD v2 (naver-clova-ix/cord-v2, revision 7f0115a4b758a71d6473b8d085751692da2fef98, CC-BY-4.0): 800 training receipts, 100 test receipts. Attribution: CORD, NAVER Clova Information Extraction, licensed CC BY 4.0.
  • Synthetic invoices (1000 train, 200 test), generated by documents/make_invoices.py with seed 20261015, English and Spanish. Labels are exact by construction. The generator is easy, so the CORD figure is the honest one.

Results

Span-level, on held-out test sets never used for training or for choosing the quantisation.

Model Test set Precision Recall Micro F1 Macro F1 Spans
ONNX fp32 (reference, not published) CORD test 94.97% 95.04% 95.00% 89.88% 1310
ONNX fp32 (reference, not published) Synthetic invoices test 100.00% 100.00% 100.00% 100.00% 7024
ONNX int8, per-channel (published) CORD test 93.10% 93.66% 93.38% 74.99% 1310
ONNX int8, per-channel (published) Synthetic invoices test 100.00% 100.00% 100.00% 100.00% 7024

Quantisation: onnxruntime quantize_dynamic, weights QInt8; per-channel was chosen on CORD validation, not on test.

Training

10 epochs, batch 8, learning rate 5e-05, on mps.

Limits

  • Field accuracy on real receipts depends on the OCR in front of it; these numbers start from CORD's own word boxes.
  • 27 words were cut at the 512-token limit when the features were built.
  • Not evaluated on languages other than English and Spanish.
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for kiberamos/the-collection-documents

Quantized
(2)
this model

Dataset used to train kiberamos/the-collection-documents