Upload 114 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- README.md +32 -3
- README_ZH.md +34 -0
- images-crops-concat/test-00000_p1.png +3 -0
- images-crops-concat/test-00000_p2.png +3 -0
- images-crops-concat/test-00001_p1.png +3 -0
- images-crops-concat/test-00001_p2.png +3 -0
- images-crops-concat/test-00002_p1.png +3 -0
- images-crops-concat/test-00002_p2.png +3 -0
- images-crops-concat/test-00003_p1.png +3 -0
- images-crops-concat/test-00003_p2.png +3 -0
- images-crops-concat/test-00004_p1.png +3 -0
- images-crops-concat/test-00004_p2.png +3 -0
- images-crops-concat/test-00004_p3.png +3 -0
- images-crops-concat/test-00005_p1.png +3 -0
- images-crops-concat/test-00005_p2.png +3 -0
- images-crops-concat/train-00000_p1.png +3 -0
- images-crops-concat/train-00000_p2.png +3 -0
- images-crops-concat/train-00003_p1.png +3 -0
- images-crops-concat/train-00003_p2.png +3 -0
- images-crops-concat/train-00005_p1.png +3 -0
- images-crops-concat/train-00005_p2.png +3 -0
- images-crops-concat/train-00006_p1.png +3 -0
- images-crops-concat/train-00006_p2.png +3 -0
- images-crops-concat/train-00009_p1.png +3 -0
- images-crops-concat/train-00009_p2.png +3 -0
- images-crops-concat/train-00010_p1.png +3 -0
- images-crops-concat/train-00010_p2.png +3 -0
- images-crops-concat/train-00012_p1.png +3 -0
- images-crops-concat/train-00012_p2.png +3 -0
- images-crops-concat/train-00015_p1.png +3 -0
- images-crops-concat/train-00015_p2.png +3 -0
- images-crops-concat/train-00018_p1.png +3 -0
- images-crops-concat/train-00018_p2.png +3 -0
- images-crops-concat/train-00020_p1.png +3 -0
- images-crops-concat/train-00020_p2.png +3 -0
- images-crops-concat/train-00021_p1.png +3 -0
- images-crops-concat/train-00021_p2.png +3 -0
- images-crops-concat/train-00024_p1.png +3 -0
- images-crops-concat/train-00024_p2.png +3 -0
- images-crops-concat/train-00025_p1.png +3 -0
- images-crops-concat/train-00025_p2.png +3 -0
- images-crops-concat/train-00027_p1.png +3 -0
- images-crops-concat/train-00027_p2.png +3 -0
- images-crops-concat/train-00030_p1.png +3 -0
- images-crops-concat/train-00030_p2.png +3 -0
- images-crops-concat/train-00033_p1.png +3 -0
- images-crops-concat/train-00033_p2.png +3 -0
- images-crops-concat/train-00033_p3.png +3 -0
- images-crops-concat/train-00035_p1.png +3 -0
- images-crops-concat/train-00035_p2.png +3 -0
README.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<a href="README.md">English</a> | <a href="README_ZH.md">中文</a>
|
| 3 |
+
</p>
|
| 4 |
+
|
| 5 |
+
# Introduction
|
| 6 |
+
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.
|
| 7 |
+
|
| 8 |
+
# Page Number Cropping
|
| 9 |
+
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).
|
| 10 |
+
|
| 11 |
+
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`.
|
| 12 |
+
|
| 13 |
+
You can run `src/2_det_onnx_wo_opencv_cuda.py` to detect page numbers, crop images, and save label files.
|
| 14 |
+
|
| 15 |
+
```shell
|
| 16 |
+
find images-labels -type f -name "*.txt" | wc -l
|
| 17 |
+
find images-crops -type f -name "*.jpg" | wc -l
|
| 18 |
+
```
|
| 19 |
+
- Number of `.txt` files in `images-labels`: 15902
|
| 20 |
+
- Number of `.jpg` files in `images-crops`: 17203
|
| 21 |
+
|
| 22 |
+
# Page Number Concatenation
|
| 23 |
+
`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.
|
| 24 |
+
|
| 25 |
+
Example
|
| 26 |
+
<img src="images-crops-concat/train-00005_p1.png" width="500">
|
| 27 |
+
|
| 28 |
+
Note: If you intend to use the label files from this dataset, they need to be cleaned separately.
|
| 29 |
+
|
| 30 |
+
# Page Number Coordinate Distribution
|
| 31 |
+
`src/4_visualize_yolo_txt_distribution.py` visualizes the distribution of bounding box centers from all label files in `images-labels`.
|
| 32 |
+
<img src="yolo_centers_distribution.png" width="500">
|
README_ZH.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<a href="README_ZH.md">中文</a> | <a href="README.md">English</a>
|
| 3 |
+
</p>
|
| 4 |
+
|
| 5 |
+
# 简介
|
| 6 |
+
本数据集的原始图片来源于[DocLayNet-v1.2](https://huggingface.co/datasets/docling-project/DocLayNet-v1.2)。 可以运行`src/1_save_img_from_parquet.py` 把parquet文件转换成图片。
|
| 7 |
+
|
| 8 |
+
# 裁剪页码
|
| 9 |
+
本数据集使用[Here](https://huggingface.co/wqzh/DocLayout-PageNumDet/tree/main/models)的`yolo11-medium-page-best-quant-ir9.onnx`权重,从上一步得到的图像中提取出页码的坐标,并裁剪出页码图片(检测可能存在错误,作者没有做任何后处理)。
|
| 10 |
+
|
| 11 |
+
裁剪图片保存在`images-crops`目录下,检测的结果保存在`images-labels`目录下。作者做了一个限制:只有检测的页码框数量为1的时候,才会保存txt格式的标注文件,而检测的所有页码框的截图会全部保留。因此,`images-crops`目录下的文件数量 会大于 `images-labels`目录下的文件数量。
|
| 12 |
+
|
| 13 |
+
可以运行`src/2_det_onnx_wo_opencv_cuda.py` 检测图片,裁剪图片,保存标注文件。
|
| 14 |
+
|
| 15 |
+
```shell
|
| 16 |
+
find images-labels -type f -name "*.txt" | wc -l
|
| 17 |
+
find images-crops -type f -name "*.jpg" | wc -l
|
| 18 |
+
```
|
| 19 |
+
- images-labels 目录下 .txt 文件数: 15902
|
| 20 |
+
- images-crops 目录下 .jpg 文件数: 17203
|
| 21 |
+
|
| 22 |
+
# 页码合并
|
| 23 |
+
`src/3_concat_crops_by_pages.py`将`images-crops`下所有的图片进行合并,并保存在`images-crops-concat`目录下。因此你可以预览整个数据集。
|
| 24 |
+
|
| 25 |
+
示例
|
| 26 |
+
<img src="images-crops-concat/train-00005_p1.png" width="500">
|
| 27 |
+
|
| 28 |
+
注意:如果要使用这个数据集的label文件,需要单独清洗。
|
| 29 |
+
|
| 30 |
+
# 页码坐标分布
|
| 31 |
+
`src/4_visualize_yolo_txt_distribution.py`将`images-labels`下所有的标注文件的坐标分布可视化。
|
| 32 |
+
<img src="yolo_centers_distribution.png" width="500">
|
| 33 |
+
|
| 34 |
+
|
images-crops-concat/test-00000_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00000_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00001_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00001_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00002_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00002_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00003_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00003_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00004_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00004_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00004_p3.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00005_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/test-00005_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00000_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00000_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00003_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00003_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00005_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00005_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00006_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00006_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00009_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00009_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00010_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00010_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00012_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00012_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00015_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00015_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00018_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00018_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00020_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00020_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00021_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00021_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00024_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00024_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00025_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00025_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00027_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00027_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00030_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00030_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00033_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00033_p2.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00033_p3.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00035_p1.png
ADDED
|
Git LFS Details
|
images-crops-concat/train-00035_p2.png
ADDED
|
Git LFS Details
|