CoolFace
Modelpublic

AvoCahDoe/invoice-layout-yolov8n

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes535downloads
Model Card

Invoice Layout Detection — YOLOv8n

Fine-tuned YOLOv8n for 8-class invoice document layout region detection (metadata, vendor/customer blocks, table, line items, summary, payment, column headers).

Part of the Hub collection [Invoice Layout Extraction](https://huggingface.co/collections/AvoCahDoe/invoice-layout-extraction-6a39cd2a061a508c8049d825).

PropertyValue
ArchitectureYOLOv8n (3.0M params, 8.1 GFLOPs)
Base weightsultralytics/yolov8n
Input size1024 px
Classes8 layout regions
Training epochs87 (best @ epoch 62)
OptimizerAdamW
DatasetAvoCahDoe/invoice-annotated-bbox
Demo SpaceAvoCahDoe/invoice-layout-yolov8n-demo
Train / val / test372 / 14 / 7 pages

Classes

IDName
0invoice_metadata
1vendor_block
2customer_block
3table_block
4line_item
5summary_block
6payment_block
7Column

Metrics

Test split (held-out, 7 images)

MetricValue
mAP500.9600
mAP50-950.7167
Precision0.9502
Recall0.9592

Validation (best epoch 62)

MetricBestFinal (epoch 87)
mAP500.87870.8282
mAP50-950.62530.6050
Precision0.88530.8439
Recall0.78490.7735

Training time: ~41.0 min on RTX 4070 Laptop GPU.

Training configuration

ParameterValue
Batch8
Image size1024
Patience25
LR (cosine)0.01 → 0.01
Mosaic1.0
Mixup0.15
Copy-paste0.1
Horizontal flip0.0

Training results

Learning curves

[image]

Precision–Recall

[image]

Confusion matrices

RawNormalized
[image][image]

Validation predictions

Ground truthModel predictions
[image][image]

Training batches (augmented)

Batch 0Batch 1Batch 2
[image][image][image]

Label distribution

[image]

Usage

Ultralytics (recommended)

python
from ultralytics import YOLO
from huggingface_hub import hf_hub_download

weights = hf_hub_download("AvoCahDoe/invoice-layout-yolov8n", "weights/best.pt")
model = YOLO(weights)
results = model.predict("invoice_page.png", imgsz=1024, conf=0.25)
results[0].show()

Load from Hub by repo id

python
from ultralytics import YOLO

model = YOLO("hf://AvoCahDoe/invoice-layout-yolov8n/weights/best.pt")
results = model.predict("invoice_page.png")

Training reproduction

bash
python scripts/train_comparison.py --models yolov8n

Repository layout

weights/best.pt          # Best checkpoint (use this)
weights/last.pt          # Last epoch checkpoint
config/                  # Training configuration
metrics/                 # Per-epoch and summary metrics
assets/                  # Plots and visualizations

Model comparison (test split)

All six architectures fine-tuned on the same invoice layout dataset.

RankModeltest mAP50test mAP50-95PrecisionRecallHub
1yolov8n ← this model0.96000.71670.95020.9592YOLOv8n
2yolov8s0.90060.67390.94190.8677YOLOv8s
3yolov8x0.87570.62240.91440.8735YOLOv8x
4yolo11x0.87380.61270.94840.8530YOLO11x
5yolo11m0.84180.49260.90330.8466YOLO11m
6yolov8m0.83880.52890.90770.8580YOLOv8m

License

Apache 2.0