YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
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.txtwere 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) andbox_multi/(83 images). Note: decide whether to usebox_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
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support