Home

Awesome

<div align="center"> <div align="center"> <h1><b>Table Recognition Metric</b></h1> </div>

<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a> <a href=""><img src="https://img.shields.io/badge/python->=3.6,<3.12-aff.svg"></a> <a href="https://pypi.org/project/table_recognition_metric/"><img alt="PyPI" src="https://img.shields.io/pypi/v/table_recognition_metric"></a> <a href="https://pepy.tech/project/table-recognition-metric"><img src="https://static.pepy.tech/personalized-badge/table-recognition-metric?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a> <a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a> <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>

</div>

简介

该库用于计算TEDS指标,用来评测表格识别算法效果。可与table_rec_test_dataset配套使用。

TEDS计算代码参考:PaddleOCRDAVAR-Lab-OCR

安装

pip install table_recognition_metric

使用说明:

命令行运行

脚本运行

[!NOTE] 如果只需要计算Struct-TEDS,只需在声明TEDS实例时,传入参数structure_only=True即可,默认该参数为False,即计算TEDS. e.g.

teds = TEDS(structure_only=True)

from table_recognition_metric import TEDS

teds = TEDS()

gt_html = '<html><body><table><tr><td>购买方</td><td colspan="5">纳税人识别号地址、电记开户行及账号</td><td>密码区</td><td colspan="4"></td></tr><tr><td colspan="2">货物或应税劳务、服务名称理肤泉清痘旅行装控油祛痘调节水油平衡理肤泉特安舒缓修护乳40ml合计</td><td>规格型号</td><td>单位</td><td>11</td><td colspan="3"></td><td></td><td>税率17%17%</td><td></td></tr><tr><td colspan="2">价税合计(大写)</td><td colspan="9"></td></tr><tr><td>销售方</td><td colspan="5">纳税人识别号地址、电话开户行及账号</td><td>备注</td><td colspan="4"></td></tr></table></body></html>'
pred_html = '<html><body><table><tr><td>购买方</td><td colspan="5">纳税人识别号地址、电记开户行及账号</td><td>密码区</td><td colspan="4"></td></tr><tr><td colspan="2">货物或应税劳务、服务名称理肤泉清痘旅行装控油祛痘调节水油平衡理肤泉特安舒缓修护乳40ml合计</td><td>规格型号</td><td>单位</td><td>11</td><td colspan="3"></td><td></td><td>税率17%17%</td><td></td></tr><tr><td colspan="2">价税合计(大写)</td><td colspan="9"></td></tr><tr><td>销售方</td><td colspan="5">纳税人识别号地址、电话开户行及账号</td><td>备注</td><td colspan="4"></td></tr></table></body></html>'

score = teds(gt_html, pred_html)
print(score)
# 1.0

数据集上评测

Tree-EditDistance-based Similarity (TEDS)

更新日志

2023-12-27 v0.0.4 update: