Object Detection
ultralytics
English
German
yolo
yolov8
invoice
document-layout
document-understanding
ocr-prep
invoice-extraction
Eval Results (legacy)
Instructions to use AvoCahDoe/invoice-layout-yolov8m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use AvoCahDoe/invoice-layout-yolov8m with ultralytics:
from ultralytics import YOLOvv8 model = YOLOvv8.from_pretrained("AvoCahDoe/invoice-layout-yolov8m") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,183 +1,32 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
-
- de
|
| 6 |
tags:
|
| 7 |
- object-detection
|
| 8 |
- yolo
|
| 9 |
-
- yolov8
|
| 10 |
-
- ultralytics
|
| 11 |
- invoice
|
| 12 |
- document-layout
|
| 13 |
-
- document-understanding
|
| 14 |
-
- ocr-prep
|
| 15 |
library_name: ultralytics
|
| 16 |
-
pipeline_tag: object-detection
|
| 17 |
-
base_model: ultralytics/yolov8m
|
| 18 |
-
datasets:
|
| 19 |
-
- AvoCahDoe/invoice-annotated-bbox
|
| 20 |
-
metrics:
|
| 21 |
-
- map_50
|
| 22 |
-
- map
|
| 23 |
-
- precision
|
| 24 |
-
- recall
|
| 25 |
-
model-index:
|
| 26 |
-
- name: best
|
| 27 |
-
results:
|
| 28 |
-
- task:
|
| 29 |
-
type: object-detection
|
| 30 |
-
dataset:
|
| 31 |
-
name: invoice-yolo-annotated
|
| 32 |
-
type: invoice-layout
|
| 33 |
-
metrics:
|
| 34 |
-
- type: map_50
|
| 35 |
-
value: 0.8388
|
| 36 |
-
- type: map
|
| 37 |
-
value: 0.5289
|
| 38 |
-
- type: precision
|
| 39 |
-
value: 0.9077
|
| 40 |
-
- type: recall
|
| 41 |
-
value: 0.8580
|
| 42 |
---
|
| 43 |
|
| 44 |
-
# Invoice Layout
|
| 45 |
|
| 46 |
-
Fine-tuned
|
| 47 |
-
|
| 48 |
-
Part of the Hub collection **[Invoice Layout Extraction](https://huggingface.co/collections/AvoCahDoe/invoice-layout-extraction-6a39cd2a061a508c8049d825)**.
|
| 49 |
-
|
| 50 |
-
| Property | Value |
|
| 51 |
-
|----------|-------|
|
| 52 |
-
| **Architecture** | YOLOv8m (25.9M params, 78.9 GFLOPs) |
|
| 53 |
-
| **Base weights** | `ultralytics/yolov8m` |
|
| 54 |
-
| **Input size** | 1024 px |
|
| 55 |
-
| **Classes** | 8 layout regions |
|
| 56 |
-
| **Training epochs** | 100 (best @ epoch 98) |
|
| 57 |
-
| **Optimizer** | AdamW |
|
| 58 |
-
| **Dataset** | [AvoCahDoe/invoice-annotated-bbox](https://huggingface.co/datasets/AvoCahDoe/invoice-annotated-bbox) |
|
| 59 |
-
| **Demo Space** | [AvoCahDoe/invoice-layout-yolov8n-demo](https://huggingface.co/spaces/AvoCahDoe/invoice-layout-yolov8n-demo) |
|
| 60 |
-
| **Train / val / test** | 372 / 14 / 7 pages |
|
| 61 |
|
| 62 |
## Classes
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|----|------|
|
| 66 |
-
| 0 | `invoice_metadata` |
|
| 67 |
-
| 1 | `vendor_block` |
|
| 68 |
-
| 2 | `customer_block` |
|
| 69 |
-
| 3 | `table_block` |
|
| 70 |
-
| 4 | `line_item` |
|
| 71 |
-
| 5 | `summary_block` |
|
| 72 |
-
| 6 | `payment_block` |
|
| 73 |
-
| 7 | `Column` |
|
| 74 |
-
|
| 75 |
-
## Metrics
|
| 76 |
|
| 77 |
-
##
|
| 78 |
|
| 79 |
| Metric | Value |
|
| 80 |
|--------|-------|
|
| 81 |
-
|
|
| 82 |
-
|
|
| 83 |
-
| **Precision** | 0.9077 |
|
| 84 |
-
| **Recall** | 0.8580 |
|
| 85 |
-
|
| 86 |
-
### Validation (best epoch 98)
|
| 87 |
-
|
| 88 |
-
| Metric | Best | Final (epoch 100) |
|
| 89 |
-
|--------|------|-----------------------------------------------|
|
| 90 |
-
| mAP50 | 0.8581 | 0.8578 |
|
| 91 |
-
| mAP50-95 | 0.5554 | 0.5544 |
|
| 92 |
-
| Precision | 0.8388 | 0.8253 |
|
| 93 |
-
| Recall | 0.7730 | 0.7651 |
|
| 94 |
-
|
| 95 |
-
Training time: ~66.6 min on RTX 4070 Laptop GPU.
|
| 96 |
-
|
| 97 |
-
## Training configuration
|
| 98 |
-
|
| 99 |
-
| Parameter | Value |
|
| 100 |
-
|-----------|-------|
|
| 101 |
-
| Batch | 6 |
|
| 102 |
-
| Image size | 1024 |
|
| 103 |
-
| Patience | 25 |
|
| 104 |
-
| LR (cosine) | 0.01 → 0.01 |
|
| 105 |
-
| Mosaic | 1.0 |
|
| 106 |
-
| Mixup | 0.15 |
|
| 107 |
-
| Copy-paste | 0.1 |
|
| 108 |
-
| Horizontal flip | 0.0 |
|
| 109 |
-
|
| 110 |
-
## Training results
|
| 111 |
-
|
| 112 |
-
### Learning curves
|
| 113 |
-
|
| 114 |
-

|
| 115 |
-
|
| 116 |
-
### Precision–Recall
|
| 117 |
-
|
| 118 |
-

|
| 119 |
-
|
| 120 |
-
### Confusion matrices
|
| 121 |
-
|
| 122 |
-
| Raw | Normalized |
|
| 123 |
-
|-----|------------|
|
| 124 |
-
|  |  |
|
| 125 |
-
|
| 126 |
-
### Validation predictions
|
| 127 |
-
|
| 128 |
-
| Ground truth | Model predictions |
|
| 129 |
-
|--------------|-------------------|
|
| 130 |
-
|  |  |
|
| 131 |
-
|
| 132 |
-
### Training batches (augmented)
|
| 133 |
-
|
| 134 |
-
| Batch 0 | Batch 1 | Batch 2 |
|
| 135 |
-
|---------|---------|---------|
|
| 136 |
-
|  |  |  |
|
| 137 |
-
|
| 138 |
-
### Label distribution
|
| 139 |
-
|
| 140 |
-

|
| 141 |
|
| 142 |
## Usage
|
| 143 |
|
| 144 |
-
### Ultralytics (recommended)
|
| 145 |
-
|
| 146 |
-
```python
|
| 147 |
-
from ultralytics import YOLO
|
| 148 |
-
from huggingface_hub import hf_hub_download
|
| 149 |
-
|
| 150 |
-
weights = hf_hub_download("AvoCahDoe/invoice-layout-yolov8m", "weights/best.pt")
|
| 151 |
-
model = YOLO(weights)
|
| 152 |
-
results = model.predict("invoice_page.png", imgsz=1024, conf=0.25)
|
| 153 |
-
results[0].show()
|
| 154 |
-
```
|
| 155 |
-
|
| 156 |
-
### Load from Hub by repo id
|
| 157 |
-
|
| 158 |
```python
|
| 159 |
from ultralytics import YOLO
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
results = model.predict("invoice_page.png")
|
| 163 |
```
|
| 164 |
-
|
| 165 |
-
### Training reproduction
|
| 166 |
-
|
| 167 |
-
```bash
|
| 168 |
-
python scripts/train_comparison.py --models yolov8m
|
| 169 |
-
```
|
| 170 |
-
|
| 171 |
-
## Repository layout
|
| 172 |
-
|
| 173 |
-
```
|
| 174 |
-
weights/best.pt # Best checkpoint (use this)
|
| 175 |
-
weights/last.pt # Last epoch checkpoint
|
| 176 |
-
config/ # Training configuration
|
| 177 |
-
metrics/ # Per-epoch and summary metrics
|
| 178 |
-
assets/ # Plots and visualizations
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
## License
|
| 182 |
-
|
| 183 |
-
Apache 2.0
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- object-detection
|
| 5 |
- yolo
|
|
|
|
|
|
|
| 6 |
- invoice
|
| 7 |
- document-layout
|
|
|
|
|
|
|
| 8 |
library_name: ultralytics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Invoice Layout — yolov8m
|
| 12 |
|
| 13 |
+
Fine-tuned yolov8m for invoice macro-region detection (8 classes).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
## Classes
|
| 16 |
|
| 17 |
+
`invoice_metadata`, `vendor_block`, `customer_block`, `table_block`, `line_item`, `summary_block`, `payment_block`, `Column`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
## Metrics (test split)
|
| 20 |
|
| 21 |
| Metric | Value |
|
| 22 |
|--------|-------|
|
| 23 |
+
| mAP50 | 0.8388 |
|
| 24 |
+
| mAP50-95 | 0.5289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Usage
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
```python
|
| 29 |
from ultralytics import YOLO
|
| 30 |
+
model = YOLO("best.pt")
|
| 31 |
+
results = model.predict("invoice.png")
|
|
|
|
| 32 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|