English | 中文
# Introduction
The original images of this dataset are from [DocLayNet-v1.2](https://huggingface.co/datasets/docling-project/DocLayNet-v1.2). You can run `src/1_save_img_from_parquet.py` to convert the parquet files into images.
# Page Number Cropping
This dataset uses the `yolo11-medium-page-best-quant-ir9.onnx` weights from [Here](https://huggingface.co/wqzh/DocLayout-PageNumDet/tree/main/models) to detect page number bounding boxes from the images obtained above, and then crop out the page number regions (detection errors may exist, as no post-processing was applied by the author).
The cropped images are saved in the `images-crops` directory, and the detection results are saved in the `images-labels` directory. The author added a constraint: the YOLO-format label file is only saved when exactly one page number box is detected, while crops of all detected boxes are retained. Therefore, the number of files in `images-crops` is greater than that in `images-labels`.
You can run `src/2_det_onnx_wo_opencv_cuda.py` to detect page numbers, crop images, and save label files.
```shell
find images-labels -type f -name "*.txt" | wc -l
find images-crops -type f -name "*.jpg" | wc -l
```
- Number of `.txt` files in `images-labels`: 15902
- Number of `.jpg` files in `images-crops`: 17203
# Page Number Concatenation
`src/3_concat_crops_by_pages.py` concatenates all cropped images from `images-crops` and saves them in the `images-crops-concat` directory, so you can preview the entire dataset.
Example
Note: If you intend to use the label files from this dataset, they need to be cleaned separately.
# Page Number Coordinate Distribution
`src/4_visualize_yolo_txt_distribution.py` visualizes the distribution of bounding box centers from all label files in `images-labels`.