Request it for the seed queue.
Getting the source files requires Hugging Face approval.Fine-tuned microsoft/layoutlmv3-base for segment-level layout classification on French Bulletin Officiel (BO) SOMMAIRE / TOC pages.
Each annotated region (page crop image + OCR words + word boxes) is encoded as one sequence; the model predicts one of 9 layout classes (LayoutLMv3ForSequenceClassification).
Gated model — trained on proprietary/internal BO annotations. Best weights from run
run_20260809_031930(checkpoint-21990 / epoch 15).
| Property | Value |
|---|---|
| Architecture | LayoutLMv3ForSequenceClassification |
| Base model | microsoft/layoutlmv3-base |
| Task | Segment-level sequence classification |
| Classes | 9 SommaireTOC layout roles |
| Input | Page/region image + word tokens + word boxes (0–1000) |
| Parameters | ~126M |
| Best checkpoint | checkpoint-21990 (epoch 15) |
| Selection metric | eval_f1_macro |
| id | label | Role |
|---|---|---|
| 0 | Titre |
TOC title line |
| 1 | Page_title |
Page number associated with a title |
| 2 | Som_Section |
Section banner inside sommaire |
| 3 | Sommaire |
SOMMAIRE header / banner |
| 4 | Page |
Standalone page number |
| 5 | Meta_Data |
Header/footer metadata |
| 6 | Tex_PAR |
Text block — PARTICULIER |
| 7 | Tex_GEN |
Text block — GENERAL |
| 8 | Tex_AVIS |
Text block — AVIS |
| Item | Value |
|---|---|
| Segments (pipeline scale) | 15,398 |
| Corrected GT titles (ref) | 3,697 |
| Task | sommaire_segment_classification |
| Run id | run_20260809_031930 |
| Domain | French Bulletin Officiel SOMMAIRE pages |
| Parameter | Value |
|---|---|
| Epochs requested | 30 |
| Epochs to best | 15 (early stopping patience 5; run stopped ~20) |
| Batch size (per device) | 4 |
| Gradient accumulation | 2 |
| Effective batch size | 8 |
| Learning rate | 2e-5 |
| Warmup ratio | 0.1 |
| Weight decay | 0.01 |
| FP16 | true |
| Optimizer metric | f1_macro |
| Best val F1 macro | 0.9680 |
| Best global step | 21990 |
Summaries: metrics/trainer_summary.json, metrics/val_best_metrics.json
From metrics/test_metrics.json:
| Metric | Value |
|---|---|
| Accuracy | 0.9867 |
| F1 macro | 0.9738 |
| F1 micro | 0.9867 |
| F1 weighted | 0.9867 |
| Precision macro | 0.9700 |
| Recall macro | 0.9790 |
| Mean confidence | 0.9971 |
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| Meta_Data | 1.00 | 0.99 | 0.994 | 90 |
| Page | 0.94 | 0.95 | 0.945 | 100 |
| Page_title | 0.99 | 0.99 | 0.989 | 593 |
| Som_Section | 0.98 | 0.97 | 0.978 | 231 |
| Sommaire | 1.00 | 0.99 | 0.995 | 96 |
| Tex_AVIS | 0.88 | 1.00 | 0.933 | 7 |
| Tex_GEN | 1.00 | 0.92 | 0.960 | 26 |
| Tex_PAR | 0.95 | 1.00 | 0.974 | 38 |
| Titre | 1.00 | 0.99 | 0.994 | 619 |
| Metric | Value |
|---|---|
| F1 macro | 0.9680 |
| Accuracy | 0.9861 |
| Epoch | 15 |
from transformers import AutoProcessor, LayoutLMv3ForSequenceClassification
import torch
from PIL import Image
repo = "AvoCahDoe/sommaire-layoutlmv3-classifier"
processor = AutoProcessor.from_pretrained(repo, apply_ocr=False)
model = LayoutLMv3ForSequenceClassification.from_pretrained(repo)
model.eval()
image = Image.open("region_crop.png").convert("RGB")
# words / boxes: list[str], list[list[int]] normalized 0–1000
encoding = processor(
image,
words=words,
boxes=boxes,
return_tensors="pt",
truncation=True,
padding="max_length",
max_length=512,
)
with torch.no_grad():
logits = model(**encoding).logits
pred_id = int(logits.argmax(-1).item())
print(model.config.id2label[pred_id])
model.safetensors, config.json
tokenizer / preprocessor files
metrics/ # test, val, run_config
plots/ # curves + confusion / comparisons
examples/ # BO page images
pdf_page → BO_page mappingTex_AVIS) have low support in testapply_ocr=False in the snippet above)AvoCahDoe/sommaire-pp-doclayout-l-proposalAvoCahDoe/layoutlmv3-bo-segmentsIf you use this model in work derived from the SommaireTOC pipeline, please cite the Hub repo and base model microsoft/layoutlmv3-base.
model.safetensors 480 MiBtraining_args.bin 5.4 KiB