当前位置: 首页 > news >正文

PubLayNet:文档布局分析领域的大规模数据集

PubLayNet:文档布局分析领域的大规模数据集

1. 数据集概述

PubLayNet(Public Layout Network)是由IBM AUR NLP团队开发的大规模文档图像数据集,旨在推动文档理解与布局分析领域的研究。该数据集通过自动标注技术,对科学文献的版面元素(如文本、标题、表格等)提供高精度的边界框和多边形分割注释,是目前文档布局分析领域规模最大、标注最完善的开放数据集之一


2. 核心特性与数据规模

2.1 数据构成

  • 数据来源:基于PubMed Central Open Access子集的科研论文(商业用途许可),覆盖生物医学、计算机科学等多学科领域
  • 标注类别:5类文档元素(Text/文本、Title/标题、List/列表、Table/表格、Figure/图表)
  • 数据量
    数据集类型图像数量
    训练集333,703张
    验证集11,245张
    测试集11,405张

2.2 技术亮点

  • 标注质量:通过PDF与XML格式匹配自动生成注释,并采用质量控制指标(99%面积覆盖率筛选)确保标注精度
  • 多模态支持:同时提供边界框(Bounding Box)和多边形分割(Polygon Segmentation)两种标注形式

3. 数据构建方法

PubLayNet的构建采用创新的自动化流程:

  1. 格式匹配:将PDF文档的视觉元素与XML结构化内容对齐,利用PDFMiner解析阅读顺序和文本块位置
  2. 模糊匹配算法:通过阈值控制的字符串相似度计算,解决PDF与XML文本的微小差异问题
  3. 质量过滤:排除注释覆盖率低于99%的非标题页,确保数据可靠性

4. 小批量数据可视化脚本

# importing prerequisites
import sys
import requests
import tarfile
import json
import numpy as np
from os import path
from PIL import Image
from PIL import ImageFont, ImageDraw
from glob import glob
from matplotlib import pyplot as plt
# %matplotlib inline
fname = 'examples.tar.gz'
url = 'https://dax-cdn.cdn.appdomain.cloud/dax-publaynet/1.0.0/' + fname
r = requests.get(url)
open(fname , 'wb').write(r.content)# Extracting the dataset
tar = tarfile.open(fname)
tar.extractall()
tar.close()# Verifying the file was extracted properly
data_path = "examples/"
path.exists(data_path)# Define color code
colors = {'title': (255, 0, 0),'text': (0, 255, 0),'figure': (0, 0, 255),'table': (255, 255, 0),'list': (0, 255, 255)}# Function to viz the annotation
def markup(image, annotations):''' Draws the segmentation, bounding box, and label of each annotation'''draw = ImageDraw.Draw(image, 'RGBA')for annotation in annotations:# Draw segmentationdraw.polygon(annotation['segmentation'][0],fill=colors[samples['categories'][annotation['category_id'] - 1]['name']] + (64,))# Draw bboxdraw.rectangle((annotation['bbox'][0],annotation['bbox'][1],annotation['bbox'][0] + annotation['bbox'][2],annotation['bbox'][1] + annotation['bbox'][3]),outline=colors[samples['categories'][annotation['category_id'] - 1]['name']] + (255,),width=2)# Draw labelw, h = draw.textsize(text=samples['categories'][annotation['category_id'] - 1]['name'],font=font)if annotation['bbox'][3] < h:draw.rectangle((annotation['bbox'][0] + annotation['bbox'][2],annotation['bbox'][1],annotation['bbox'][0] + annotation['bbox'][2] + w,annotation['bbox'][1] + h),fill=(64, 64, 64, 255))draw.text((annotation['bbox'][0] + annotation['bbox'][2],annotation['bbox'][1]),text=samples['categories'][annotation['category_id'] - 1]['name'],fill=(255, 255, 255, 255),font=font)else:draw.rectangle((annotation['bbox'][0],annotation['bbox'][1],annotation['bbox'][0] + w,annotation['bbox'][1] + h),fill=(64, 64, 64, 255))draw.text((annotation['bbox'][0],annotation['bbox'][1]),text=samples['categories'][annotation['category_id'] - 1]['name'],fill=(255, 255, 255, 255),font=font)return np.array(image)# Parse the JSON file and read all the images and labels
with open('examples/samples.json', 'r') as fp:samples = json.load(fp)
# Index images
images = {}
for image in samples['images']:images[image['id']] = {'file_name': "examples/" + image['file_name'], 'annotations': []}
for ann in samples['annotations']:images[ann['image_id']]['annotations'].append(ann)
# Visualize annotations
font = ImageFont.truetype("examples/DejaVuSans.ttf", 15)
fig=plt.figure(figsize=(16, 100)) 
for i, (_, image) in enumerate(images.items()):with Image.open(image['file_name']) as img:ax = plt.subplot(int(len(images) / 2), 2, i + 1)ax.imshow(markup(img, image['annotations']))ax.axis('off')
plt.subplots_adjust(hspace=0, wspace=0)
plt.savefig('examples/annotations.png')

5. 获取与使用

  • 下载地址:IBM开发者平台
  • 许可协议:遵循CDLA-Permissive开源协议,允许商业用途
  • 快速体验:提供预训练模型和演示脚本,支持快速部署

参考文献

  1. 推荐开源项目:PubLayNet——文档图像布局标注的利器
  2. PubLayNet数据集文档
  3. PubLayNet官方介绍
  4. PubLayNet技术应用分析
  5. 基于PubLayNet的Transformer模型研究
  6. PubLayNet数据规模说明
  7. 多模态方法在PubLayNet上的应用
  8. CSDN技术博客
  9. PaddleDetection模型库
  10. 数据生成方法详解

相关文章:

  • WeakAuras Lua Script TOC BOSS2 <Lord Jaraxxus>
  • 学习设计模式《五》——工厂方法模式
  • 深度解析n8n全自动AI视频生成与发布工作流
  • 无人船 | 图解基于PID控制的路径跟踪算法(以欠驱动无人艇Otter为例)
  • 珈和科技助力“农险提效200%”!“遥感+”技术创新融合省级示范项目荣登《湖北卫视》!
  • 大数据利器:Kafka与Spark的深度探索
  • gem5 笔记01 gem5 基本应用流程
  • SpringBoot整合SSE,基于okhttp
  • 融山科技前端面经
  • 如何解决极狐GitLab 合并冲突?
  • 集结号海螺捕鱼游戏源码解析(第三篇):拉霸机模块开发详解与服务器开奖机制
  • 【Unity】简单实现基于TCP的阻塞式Socket的文本消息通信
  • 极狐GitLab 如何撤销变更?
  • git提交
  • [java八股文][Java基础面试篇]I/O
  • 缓存与数据库一致性方案
  • 二进制部署Kubernetes1.32.4最新版本高可用集群及附加组件
  • 最新扣子(Coze)案例教程:Excel数据生成统计图表,自动清洗数据+转换可视化图表+零代码,完全免费教程
  • 【TeamFlow】4.3.4 长度单位
  • FPGA开发流程初识
  • 魔都眼|上海环球马术冠军赛收官,英国骑手夺冠
  • 马克思主义理论研究教学名师系列访谈|金瑶梅:教师需要了解学生的现实发展,把握其思想发展动态
  • 遭反特朗普情绪拖累?澳大利亚联盟党大选落败、党魁痛失议席
  • 准85后青海海北州副州长、州公安局局长李贤荣挂职临沂市副市长
  • 甘肃公布校园食品安全专项整治案例,有食堂涉腐败变质食物
  • 陈逸飞《黄河颂》人物造型与借鉴影像意义