YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

δΈ­ζ–‡ | English

DocLayout Page Number Detection

A YOLO-based dataset and model for detecting page numbers in document images.

Introduction

This dataset is built from the DocLayNet-v1.2 parquet files:

  • 14,184 images selected from misc/selected_pngs.txt were annotated. See that file for the corresponding parquet list. Some images share similar page number layouts and were not all annotated; others have no page numbers.
  • 4,899 images annotated in total: box_single/ (4,816 images) and box_multi/ (83 images). Note: decide whether to use box_multi/, as it may mislead the model.
  • 334 images without page numbers included as negative examples under no_boxes/.
  • 1,026 images from Chinese-format books selected from HuggingFace or ModelScope are under pipe-adp/.

Labels

β”œβ”€β”€ DocLayout-PageNumDet/
    β”œβ”€β”€ labels/
    β”‚   β”œβ”€β”€ box_single/
    β”‚   β”‚   β”œβ”€β”€ image_1.txt
    β”‚   β”‚   β”œβ”€β”€ image_2.txt
    β”‚   β”‚
    β”‚   β”œβ”€β”€ no_boxes/
    β”‚       β”œβ”€β”€ image_a.txt (empty txt file)
    β”‚       β”œβ”€β”€ image_b.txt
...

Models

DocLayout-PageNumDet/models
    β”œβ”€β”€ ch_PP-OCRv3_rec_infer.onnx            (PaddleOCR recognition model)
    β”œβ”€β”€ ppocr_keys_v1.txt                     (OCR character set)
    β”œβ”€β”€ yolo11-medium-page-best.pt            (YOLO11 medium, .pt format)
    β”œβ”€β”€ yolo11-medium-page-best-quant-ir9.onnx (ONNX quantized)
    β”œβ”€β”€ yolo11-nano-page-best.pt
    β”œβ”€β”€ yolo11-nano-page-best-quant-ir9.onnx
    β”œβ”€β”€ yolo11-small-page-best.pt
    └── yolo11-small-page-best-quant-ir9.onnx

For better detection performance, consider model ensemble.

Usage

Process a single image: detect page number boxes, run OCR, and return:

[[x1, y1, x2, y2, conf, text], ...]
  • List length = number of detected boxes.
  • Each tuple = box coordinates, confidence, and recognized text (page number).
  • Cropped page number images are saved in ./tmp/.
# python src/det_and_ocr_pt.py <image_or_dir>
# python src/det_and_ocr_onnx.py <image_or_dir>
# python src/det_and_ocr_onnx_wo_opencv.py <image_or_dir>   # without OpenCV dependency

# single image
CUDA_VISIBLE_DEVICES=1 python src/det_and_ocr_pt.py examples/00-80T-80_433.png
CUDA_VISIBLE_DEVICES=1 python src/det_and_ocr_onnx.py examples/00-80T-80_433.png

# directory
CUDA_VISIBLE_DEVICES=1 python src/det_and_ocr_pt.py examples/
CUDA_VISIBLE_DEVICES=1 python src/det_and_ocr_onnx.py examples/

ONNX Export

Export .pt models to ONNX with quantization:

python src/export_onnx.py

ONNX File Size Comparison

37M     models/yolo11-small-page-best-ir9.onnx
37M     models/yolo11-small-page-best.onnx
37M     models/yolo11-small-page-best.onnx.data
19M     models/yolo11-small-page-best.pt
9.3M    models/yolo11-small-page-best-quant-ir9.onnx
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support