ppaanngggg/yolo-doclaynet

YOLO models trained by DocLayNet - power your Document Intelligent by Layout Analysis

Python

165

49 commits

updated Mar 10, 2026

See the code

README

YOLO DocLayNet

Hugging Face

🔥 Latest Updates

  • 2026/03/10: Released YOLOv26 models - Get YOLOv26x
  • 2025/03/10: Released YOLOv12 models - Get YOLOv12x
  • 2024/10/07: Released YOLOv11 models - Get YOLOv11x
  • 2024/07/10: Released YOLOv10 models - Get YOLOv10x
  • 2024/06/21: Released YOLOv9 models

🎯 Model Demo

Original Document YOLO Detection Result

Document layout detection using YOLOv8n-DocLayNet

📊 Performance Results

Model Performance Comparison Chart (mAP50-95)

Model Performance Comparison Plot

Performance comparison of different YOLO models on DocLayNet test dataset

Detailed Model Performance Metrics (Parameters/mAP50-95)

Size/ModelYOLO26YOLOv12YOLOv11YOLOv10YOLOv9YOLOv8
Nano2.4M/0.7742.6M/0.7562.6M/0.7352.3M/0.7302.0M/0.7373.2M/0.718
Small9.5M/0.8039.3M/0.7829.4M/0.7677.2M/0.7627.2M/0.76611.2M/0.752
Medium20.4M/0.8120.2M/0.78820.1M/0.78115.4M/0.78020.1M/0.77525.9M/0.775
Large24.8M/0.8226.4M/0.79225.3M/0.79324.4M/0.79025.5M/0.78243.7M/0.783
Extra55.7M/0.81959.1M/0.79456.9M/0.79429.5M/0.793-68.2M/0.787

Refer to Detail Results

Why this repo?

RAG (Retrieval Augmented Generation) is widely used today for chatting with documents. But when documents have complex layouts, the performance often suffers. It's hard to properly extract and structure content from these complex documents. This project offers a fast and effective solution to this problem.

  1. YOLO is a leading object detection model by Ultralytics. It comes in 5 different sizes and has a robust framework for training and deployment. I picked YOLO because of these strengths.

  2. DocLayNet is a dataset of 80,863 document pages with human-labeled layout information. It includes many different types of documents and is currently the best dataset available for document layout analysis.

What I did?

Here's what I did:

  1. Created a script that converts DocLayNet data into YOLO's training format
  2. Built code for training, testing and running the models
  3. Trained and shared YOLO models in all sizes and versions

How to use?

from ultralytics import YOLO

model = YOLO("{path to model file}")
pred = model("{path to test image}")
print(pred)

The definition of predict result please refer to the doc.

Server

You can simply python main.py to serve the model. Open http://localhost:8000/redoc check the API.

Dataset

DocLayNet can be found more details and download at this link. It has 11 labels:

  • Text: Regular paragraphs.
  • Picture: A graphic or photograph.
  • Caption: Special text outside a picture or table that introduces this picture or table.
  • Section-header: Any kind of heading in the text, except overall document title.
  • Footnote: Typically small text at the bottom of a page, with a number or symbol that is referred to in the text above.
  • Formula: Mathematical equation on its own line.
  • Table: Material arranged in a grid alignment with rows and columns, often with separator lines.
  • List-item: One element of a list, in a hanging shape, i.e., from the second line onwards the paragraph is indented more than the first line.
  • Page-header: Repeating elements like page number at the top, outside of the normal text flow.
  • Page-footer: Repeating elements like page number at the bottom, outside of the normal text flow.
  • Title: Overall title of a document, (almost) exclusively on the first page and typically appearing in large font.

Prepare data

You can download the processed dataset directly from Hugging Face: hantian/doclaynet-for-yolo.

Alternatively, you can prepare the data manually:

  1. download DocLayNet dataset by this link
  2. unzip to datasets folder
  3. use my convert script to make datasets ready for training
wget https://codait-cos-dax.s3.us.cloud-object-storage.appdomain.cloud/dax-doclaynet/1.0.0/DocLayNet_core.zip
mkdir datasets
mv DocLayNet_core.zip datasets/
cd datasets/ && unzip DocLayNet_core.zip && rm DocLayNet_core.zip
cd ../
python convert_dataset.py

Train & Eval

train

After preparing data, thanks to Ultralytics, training is super easy. You can choose base models from this link. I use the YOLOv8 series.

python train.py {base-model}

Eval

After training, you can evaluate your best model on test split.

python eval.py {path-to-your-model}

Detail Results

YOLOv26 Models

labelboxesyolov26nyolov26syolov26myolov26lyolov26x
Params (M)2.49.520.424.855.7
Caption15420.7450.7740.7720.770.769
Footnote3870.7740.820.8030.8230.839
Formula19660.70.7570.7960.8160.817
List-item105210.8550.8760.8760.8790.871
Page-footer39870.6160.6620.6680.6990.689
Page-header33650.7440.7680.7850.7860.79
Picture34970.770.7870.7910.8110.811
Section-header85440.7420.7540.7550.7610.752
Table23940.8670.8790.890.8930.895
Text299170.8820.8990.9030.9080.903
Title3340.8240.8580.8710.8780.876
All664540.7740.8030.810.820.819

YOLOv12 Models

labelboxesyolov12nyolov12syolov12myolov12lyolov12x
Params (M)2.69.320.226.459.1
Caption15420.7440.7630.7760.780.774
Footnote3870.6710.7120.7170.7110.696
Formula19660.6880.720.7340.7420.763
List-item105210.8280.8450.8510.850.841
Page-footer39870.6240.6490.6490.6560.671
Page-header33650.7370.7740.7720.7940.793
Picture34970.7650.7990.7930.7980.812
Section-header85440.7320.7510.760.7640.766
Table23940.8610.8790.8820.8890.888
Text299170.8630.8780.8840.8840.88
Title3340.8060.8310.8480.8420.846
All664540.7560.7820.7880.7920.794

YOLOv11 Models

labelboxesyolov11nyolov11syolov11myolov11lyolov11x
Params (M)2.69.420.125.356.9
Caption15420.7170.7440.7460.7720.765
Footnote3870.6340.6830.7010.7150.71
Formula19660.6730.7050.7290.750.765
List-item105210.810.8360.8430.8470.845
Page-footer39870.5910.6210.6530.6780.684
Page-header33650.7040.760.7780.7880.795
Picture34970.7580.7830.80.8050.802
Section-header85440.7130.7450.7530.750.751
Table23940.8460.8740.880.8910.89
Text299170.8510.8690.8780.880.883
Title3340.7930.8170.8320.8440.848
All664540.7350.7670.7810.7930.794

YOLOv10 Models

labelboxesyolov10nyolov10syolov10myolov10byolov10lyolov10x
Params (M)2.37.215.419.124.429.5
Caption15420.7130.7380.7610.7620.7720.77
Footnote3870.6420.6810.7130.720.7220.725
Formula19660.6480.6980.7270.7150.7360.76
List-item105210.8030.8330.8450.8440.8510.849
Page-footer39870.60.6140.6450.6590.6710.661
Page-header33650.6990.7610.7650.7740.7790.79
Picture34970.7490.7780.790.8030.80.806
Section-header85440.710.7290.7420.7440.7430.748
Table23940.8390.8630.8790.8790.8910.889
Text299170.850.8680.8790.8740.880.882
Title3340.7740.8220.8380.8460.8450.848
All664540.730.7620.780.7840.790.793

YOLOv9 Models

labelboxesyolov9tyolov9syolov9myolov9c
Params (M)2.07.220.125.5
Caption15420.680.7350.7490.746
Footnote3870.6380.6840.6930.689
Formula19660.6780.7190.7370.752
List-item105210.8020.8270.8380.843
Page-footer39870.5990.6120.620.65
Page-header33650.7310.770.770.785
Picture34970.7640.7890.7870.796
Section-header85440.720.7360.7420.741
Table23940.860.880.8810.884
Text299170.8560.8690.8740.877
Title3340.7780.810.8360.838
All664540.7370.7660.7750.782

YOLOv8 Models

labelboxesyolov8nyolov8syolov8myolov8lyolov8x
Params (M)3.211.225.943.768.2
Caption15420.6820.7210.7460.750.753
Footnote3870.6140.6690.6960.7020.717
Formula19660.6550.6950.7230.750.747
List-item105210.7890.8180.8360.8410.841
Page-footer39870.5880.610.640.6410.655
Page-header33650.7070.7540.7690.7760.784
Picture34970.7230.7620.7890.7960.805
Section-header85440.7090.7270.7420.750.748
Table23940.820.8540.880.8850.886
Text299170.8450.860.8760.8780.877
Title3340.7620.8060.830.8460.84
All664540.7180.7520.7750.7830.787
doclaynet
document-analysis
layout-analysis
ultralytics
yolo
yolov8

ppaanngggg/yolo-doclaynet

YOLO models trained by DocLayNet - power your Document Intelligent by Layout Analysis

Python

165

49 commits

updated Mar 10, 2026

See the code

README

YOLO DocLayNet

Hugging Face

🔥 Latest Updates

  • 2026/03/10: Released YOLOv26 models - Get YOLOv26x
  • 2025/03/10: Released YOLOv12 models - Get YOLOv12x
  • 2024/10/07: Released YOLOv11 models - Get YOLOv11x
  • 2024/07/10: Released YOLOv10 models - Get YOLOv10x
  • 2024/06/21: Released YOLOv9 models

🎯 Model Demo

Original Document YOLO Detection Result

Document layout detection using YOLOv8n-DocLayNet

📊 Performance Results

Model Performance Comparison Chart (mAP50-95)

Model Performance Comparison Plot

Performance comparison of different YOLO models on DocLayNet test dataset

Detailed Model Performance Metrics (Parameters/mAP50-95)

Size/ModelYOLO26YOLOv12YOLOv11YOLOv10YOLOv9YOLOv8
Nano2.4M/0.7742.6M/0.7562.6M/0.7352.3M/0.7302.0M/0.7373.2M/0.718
Small9.5M/0.8039.3M/0.7829.4M/0.7677.2M/0.7627.2M/0.76611.2M/0.752
Medium20.4M/0.8120.2M/0.78820.1M/0.78115.4M/0.78020.1M/0.77525.9M/0.775
Large24.8M/0.8226.4M/0.79225.3M/0.79324.4M/0.79025.5M/0.78243.7M/0.783
Extra55.7M/0.81959.1M/0.79456.9M/0.79429.5M/0.793-68.2M/0.787

Refer to Detail Results

Why this repo?

RAG (Retrieval Augmented Generation) is widely used today for chatting with documents. But when documents have complex layouts, the performance often suffers. It's hard to properly extract and structure content from these complex documents. This project offers a fast and effective solution to this problem.

  1. YOLO is a leading object detection model by Ultralytics. It comes in 5 different sizes and has a robust framework for training and deployment. I picked YOLO because of these strengths.

  2. DocLayNet is a dataset of 80,863 document pages with human-labeled layout information. It includes many different types of documents and is currently the best dataset available for document layout analysis.

What I did?

Here's what I did:

  1. Created a script that converts DocLayNet data into YOLO's training format
  2. Built code for training, testing and running the models
  3. Trained and shared YOLO models in all sizes and versions

How to use?

from ultralytics import YOLO

model = YOLO("{path to model file}")
pred = model("{path to test image}")
print(pred)

The definition of predict result please refer to the doc.

Server

You can simply python main.py to serve the model. Open http://localhost:8000/redoc check the API.

Dataset

DocLayNet can be found more details and download at this link. It has 11 labels:

  • Text: Regular paragraphs.
  • Picture: A graphic or photograph.
  • Caption: Special text outside a picture or table that introduces this picture or table.
  • Section-header: Any kind of heading in the text, except overall document title.
  • Footnote: Typically small text at the bottom of a page, with a number or symbol that is referred to in the text above.
  • Formula: Mathematical equation on its own line.
  • Table: Material arranged in a grid alignment with rows and columns, often with separator lines.
  • List-item: One element of a list, in a hanging shape, i.e., from the second line onwards the paragraph is indented more than the first line.
  • Page-header: Repeating elements like page number at the top, outside of the normal text flow.
  • Page-footer: Repeating elements like page number at the bottom, outside of the normal text flow.
  • Title: Overall title of a document, (almost) exclusively on the first page and typically appearing in large font.

Prepare data

You can download the processed dataset directly from Hugging Face: hantian/doclaynet-for-yolo.

Alternatively, you can prepare the data manually:

  1. download DocLayNet dataset by this link
  2. unzip to datasets folder
  3. use my convert script to make datasets ready for training
wget https://codait-cos-dax.s3.us.cloud-object-storage.appdomain.cloud/dax-doclaynet/1.0.0/DocLayNet_core.zip
mkdir datasets
mv DocLayNet_core.zip datasets/
cd datasets/ && unzip DocLayNet_core.zip && rm DocLayNet_core.zip
cd ../
python convert_dataset.py

Train & Eval

train

After preparing data, thanks to Ultralytics, training is super easy. You can choose base models from this link. I use the YOLOv8 series.

python train.py {base-model}

Eval

After training, you can evaluate your best model on test split.

python eval.py {path-to-your-model}

Detail Results

YOLOv26 Models

labelboxesyolov26nyolov26syolov26myolov26lyolov26x
Params (M)2.49.520.424.855.7
Caption15420.7450.7740.7720.770.769
Footnote3870.7740.820.8030.8230.839
Formula19660.70.7570.7960.8160.817
List-item105210.8550.8760.8760.8790.871
Page-footer39870.6160.6620.6680.6990.689
Page-header33650.7440.7680.7850.7860.79
Picture34970.770.7870.7910.8110.811
Section-header85440.7420.7540.7550.7610.752
Table23940.8670.8790.890.8930.895
Text299170.8820.8990.9030.9080.903
Title3340.8240.8580.8710.8780.876
All664540.7740.8030.810.820.819

YOLOv12 Models

labelboxesyolov12nyolov12syolov12myolov12lyolov12x
Params (M)2.69.320.226.459.1
Caption15420.7440.7630.7760.780.774
Footnote3870.6710.7120.7170.7110.696
Formula19660.6880.720.7340.7420.763
List-item105210.8280.8450.8510.850.841
Page-footer39870.6240.6490.6490.6560.671
Page-header33650.7370.7740.7720.7940.793
Picture34970.7650.7990.7930.7980.812
Section-header85440.7320.7510.760.7640.766
Table23940.8610.8790.8820.8890.888
Text299170.8630.8780.8840.8840.88
Title3340.8060.8310.8480.8420.846
All664540.7560.7820.7880.7920.794

YOLOv11 Models

labelboxesyolov11nyolov11syolov11myolov11lyolov11x
Params (M)2.69.420.125.356.9
Caption15420.7170.7440.7460.7720.765
Footnote3870.6340.6830.7010.7150.71
Formula19660.6730.7050.7290.750.765
List-item105210.810.8360.8430.8470.845
Page-footer39870.5910.6210.6530.6780.684
Page-header33650.7040.760.7780.7880.795
Picture34970.7580.7830.80.8050.802
Section-header85440.7130.7450.7530.750.751
Table23940.8460.8740.880.8910.89
Text299170.8510.8690.8780.880.883
Title3340.7930.8170.8320.8440.848
All664540.7350.7670.7810.7930.794

YOLOv10 Models

labelboxesyolov10nyolov10syolov10myolov10byolov10lyolov10x
Params (M)2.37.215.419.124.429.5
Caption15420.7130.7380.7610.7620.7720.77
Footnote3870.6420.6810.7130.720.7220.725
Formula19660.6480.6980.7270.7150.7360.76
List-item105210.8030.8330.8450.8440.8510.849
Page-footer39870.60.6140.6450.6590.6710.661
Page-header33650.6990.7610.7650.7740.7790.79
Picture34970.7490.7780.790.8030.80.806
Section-header85440.710.7290.7420.7440.7430.748
Table23940.8390.8630.8790.8790.8910.889
Text299170.850.8680.8790.8740.880.882
Title3340.7740.8220.8380.8460.8450.848
All664540.730.7620.780.7840.790.793

YOLOv9 Models

labelboxesyolov9tyolov9syolov9myolov9c
Params (M)2.07.220.125.5
Caption15420.680.7350.7490.746
Footnote3870.6380.6840.6930.689
Formula19660.6780.7190.7370.752
List-item105210.8020.8270.8380.843
Page-footer39870.5990.6120.620.65
Page-header33650.7310.770.770.785
Picture34970.7640.7890.7870.796
Section-header85440.720.7360.7420.741
Table23940.860.880.8810.884
Text299170.8560.8690.8740.877
Title3340.7780.810.8360.838
All664540.7370.7660.7750.782

YOLOv8 Models

labelboxesyolov8nyolov8syolov8myolov8lyolov8x
Params (M)3.211.225.943.768.2
Caption15420.6820.7210.7460.750.753
Footnote3870.6140.6690.6960.7020.717
Formula19660.6550.6950.7230.750.747
List-item105210.7890.8180.8360.8410.841
Page-footer39870.5880.610.640.6410.655
Page-header33650.7070.7540.7690.7760.784
Picture34970.7230.7620.7890.7960.805
Section-header85440.7090.7270.7420.750.748
Table23940.820.8540.880.8850.886
Text299170.8450.860.8760.8780.877
Title3340.7620.8060.830.8460.84
All664540.7180.7520.7750.7830.787
doclaynet
document-analysis
layout-analysis
ultralytics
yolo
yolov8