WTW-Dataset 开源项目使用教程

WTW-Dataset 开源项目使用教程

WTW-Dataset This is an official implementation for the WTW Dataset in "Parsing Table Structures in the Wild " on table detection and table structure recognition. WTW-Dataset 项目地址: https://gitcode.com/gh_mirrors/wt/WTW-Dataset

1. 项目介绍

WTW-Dataset 是一个用于表格检测和表格结构识别的官方实现项目。该项目基于 ICCV 2021 论文 "Parsing Table Structures in the Wild" 构建,旨在提供一个包含多种挑战性案例的表格数据集。WTW-Dataset 涵盖了 7 种不同的挑战性案例,包括倾斜表格、曲线表格、遮挡或模糊表格、极端宽高比表格、叠加表格、多色表格以及不规则表格。数据集包含 14581 张图像,并提供了详细的标注信息。

2. 项目快速启动

2.1 克隆项目

首先,克隆 WTW-Dataset 项目到本地:

git clone https://github.com/wangwen-whu/WTW-Dataset.git
cd WTW-Dataset

2.2 安装依赖

确保你已经安装了 Python 环境,然后安装所需的依赖包:

pip install -r requirements.txt

2.3 数据转换

WTW-Dataset 提供了将 XML 格式数据转换为其他常见格式的脚本。以下是一些示例:

2.3.1 将 XML 转换为 COCO 格式
python xmltococo.py --input_dir path/to/xml/files --output_dir path/to/output/json
2.3.2 将 XML 转换为 HTML 格式
python xmltohtml.py --input_dir path/to/xml/files --output_dir path/to/output/html

3. 应用案例和最佳实践

3.1 表格检测

WTW-Dataset 可以用于训练和评估表格检测模型。以下是一个简单的应用案例:

import cv2
import xml.etree.ElementTree as ET

def detect_tables(image_path, xml_path):
    image = cv2.imread(image_path)
    tree = ET.parse(xml_path)
    root = tree.getroot()
    
    for table in root.findall('table'):
        bbox = table.find('bbox')
        x1, y1, x2, y2 = map(int, bbox.text.split(','))
        cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
    
    cv2.imshow('Detected Tables', image)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

# 示例调用
detect_tables('path/to/image.jpg', 'path/to/annotation.xml')

3.2 表格结构识别

WTW-Dataset 还可以用于表格结构识别任务。以下是一个简单的应用案例:

def recognize_table_structure(xml_path):
    tree = ET.parse(xml_path)
    root = tree.getroot()
    
    for table in root.findall('table'):
        print(f"Table ID: {table.find('id').text}")
        for cell in table.findall('cell'):
            print(f"Cell: {cell.find('bbox').text}, Start: {cell.find('start').text}, End: {cell.find('end').text}")

# 示例调用
recognize_table_structure('path/to/annotation.xml')

4. 典型生态项目

4.1 Cycle-Centernet

Cycle-Centernet 是 WTW-Dataset 中使用的一个表格检测模型。尽管模型代码未公开,但可以通过提供的在线测试链接进行测试。

4.2 其他表格处理工具

WTW-Dataset 可以与其他表格处理工具结合使用,例如 OpenCV 用于图像处理,Pandas 用于表格数据分析等。


通过以上步骤,你可以快速上手 WTW-Dataset 项目,并将其应用于表格检测和结构识别任务中。

WTW-Dataset This is an official implementation for the WTW Dataset in "Parsing Table Structures in the Wild " on table detection and table structure recognition. WTW-Dataset 项目地址: https://gitcode.com/gh_mirrors/wt/WTW-Dataset

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

施余牧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值