File size: 4,457 Bytes
9f0e4d5 1bfe224 747d7e3 9f0e4d5 50d9a4d 747d7e3 f4b1146 747d7e3 9f0e4d5 c64c15d 9f0e4d5 747d7e3 9f0e4d5 747d7e3 9f0e4d5 747d7e3 9f0e4d5 747d7e3 9f0e4d5 747d7e3 9f0e4d5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
---
license: apache-2.0
language:
- zh
size_categories:
- 1K<n<10K
---
# CDLA: A Chinese document layout analysis (CDLA) dataset
### 介绍
CDLA是一个中文文档版面分析数据集,面向中文文献类(论文)场景。包含以下10个label:
|正文|标题|图片|图片标题|表格|表格标题|页眉|页脚|注释|公式|
|---|---|---|---|---|---|---|---|---|---|
|Text|Title|Figure|Figure caption|Table|Table caption|Header|Footer|Reference|Equation|
共包含5000张训练集和1000张验证集,分别在train和val目录下。
整理自:[CDLA](https://github.com/buptlihang/CDLA)
标注可视化:
![](./assets/demo.png)
### 使用方式
```python
from datasets import load_dataset
dataset = load_dataset("SWHL/CDLA")
train_data = dataset["train"]
print(train_data[0])
val_data = dataset["validation"]
print(val_data[0])
# {'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=1240x1754 at 0x12FEE3DF0>,
# 'version': '4.5.6', 'flags': {},
# 'shapes': [
# {'label': 'Header', 'points': [[118.0, 135.66666666666669]], 'group_id': None, 'shape_type': 'polygon', 'flags': {}}
# ],
# 'imagePath': 'train_0001.jpg', 'imageData': None, 'imageHeight': 1754, 'imageWidth': 1240}
```
### 下载链接
- 百度云下载:[link](https://pan.baidu.com/s/1449mhds2ze5JLk-88yKVAA), 提取码: tp0d
- Google Drive Download:[link](https://drive.google.com/file/d/14SUsp_TG8OPdK0VthRXBcAbYzIBjSNLm/view?usp=sharing)
### 标注格式
我们的标注工具是labelme,所以标注格式和labelme格式一致。这里说明一下比较重要的字段:
- `shapes`: shapes字段是一个list,里面有多个dict,每个dict代表一个标注实例。
- `labels`: 类别。
- `points`: 实例标注。因为我们的标注是Polygon形式,所以points里的坐标数量可能大于4。
- `shape_type`: "polygon"
- `imagePath`: 图片路径/名
- `imageHeight`: 高
- `imageWidth`: 宽
展示一个完整的标注样例:
<details>
```json
{
"version":"4.5.6",
"flags":{},
"shapes":[
{
"label":"Title",
"points":[
[
553.1111111111111,
166.59259259259258
],
[
553.1111111111111,
198.59259259259258
],
[
686.1111111111111,
198.59259259259258
],
[
686.1111111111111,
166.59259259259258
]
],
"group_id":null,
"shape_type":"polygon",
"flags":{}
},
{
"label":"Text",
"points":[
[
250.5925925925925,
298.0740740740741
],
[
250.5925925925925,
345.0740740740741
],
[
188.5925925925925,
345.0740740740741
],
[
188.5925925925925,
410.0740740740741
],
[
188.5925925925925,
456.0740740740741
],
[
324.5925925925925,
456.0740740740741
],
[
324.5925925925925,
410.0740740740741
],
[
1051.5925925925926,
410.0740740740741
],
[
1051.5925925925926,
345.0740740740741
],
[
1052.5925925925926,
345.0740740740741
],
[
1052.5925925925926,
298.0740740740741
]
],
"group_id":null,
"shape_type":"polygon",
"flags":{}
},
{
"label":"Footer",
"points":[
[
1033.7407407407406,
1634.5185185185185
],
[
1033.7407407407406,
1646.5185185185185
],
[
1052.7407407407406,
1646.5185185185185
],
[
1052.7407407407406,
1634.5185185185185
]
],
"group_id":null,
"shape_type":"polygon",
"flags":{}
}
],
"imagePath":"val_0031.jpg",
"imageData":null,
"imageHeight":1754,
"imageWidth":1240
}
```
</details>
### 转COCO格式
```bash
# train
python3 labelme2coco.py CDLA_dir/train train_save_path --labels labels.txt
# val
python3 labelme2coco.py CDLA_dir/val val_save_path --labels labels.txt
```
转换结果保存在train_save_path/val_save_path目录下。
labelme2coco.py取自labelme,更多信息请参考[labelme官方项目](https://github.com/wkentaro/labelme/tree/master/examples/instance_segmentation) |