PPOCRLabel复杂表格标注,导出gt.txt内容不对 #12421
Replies: 4 comments 2 replies
-
PPOCRLabel/libs/utils.py中的convert_token方法中 |
Beta Was this translation helpful? Give feedback.
-
thank you for up this issue, i have a question in using PPOCRLabel about the rowspan and colspan when gt.txt file is generated. did PPOCRLabel automatic know the rowspan and colspan or you edit manually the rowspan and colspan for matching the image file ? because i have an issue when i know there is a merge cell in my image/table, table recognition sometime not recognize that. can you tell me how to annoted for the merge cell in PPOCRLabel, because i still don't know how to annoted for the merge cell. thank you so much |
Beta Was this translation helpful? Give feedback.
-
First of all, when marking the table structure, I usually first use the table recognition model provided in PPOCRLabel to conduct a preliminary table structure recognition. Then manually adjust the table recognition results to make them consistent with the structure of your picture/table. Then export the labeling results. |
Beta Was this translation helpful? Give feedback.
-
下面这幅图是我使用PPOCRLabel进行表格标注,调整完cell顺序,以及空cell后的截图
对应的,我也调整了excel文件中表格的格式,下面是导出表格标注后gt.txt文件中的内容
{"filename": "0003.jpg", "html": {"structure": {"tokens": ["<tbody>", "<tr>", "<td>", "</td>", "<td", " colspan=\"2\"", ">", "</td>", "<td", " colspan=\"2\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"1\"", ">", "</td>", "<td", " rowspan=\"3\"", ">", "</td>", "<td", " rowspan=\"3\"", ">", "</td>", "<td", " rowspan=\"3\"", ">", "</td>", "<td", " rowspan=\"3\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"9\"", ">", "</td>", "<td", " rowspan=\"9\"", ">", "</td>", "<td", " rowspan=\"4\"", ">", "</td>", "<td", " rowspan=\"4\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"2\"", ">", "</td>", "<td", " rowspan=\"2\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"3\"", ">", "</td>", "<td", " rowspan=\"3\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"7\"", ">", "</td>", "<td", " rowspan=\"7\"", ">", "</td>", "<td", " rowspan=\"4\"", ">", "</td>", "<td", " rowspan=\"4\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"3\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td", " rowspan=\"2\"", ">", "</td>", "<td>", "</td>", "<td>", "</td>", "</tr>", "<tr>", "<td>", "</td>", "<td>", "</td>", "</tr>", "</tbody>"]}, "cells": [{"tokens": ["分", "面"], "bbox": [[37, 22], [74, 22], [74, 45], [37, 45]]}, {"tokens": ["一", "级", "分", "类"], "bbox": [[125, 22], [190, 22], [190, 44], [125, 44]]}, {"tokens": ["二", "级", "分", "类"], "bbox": [[242, 23], [308, 23], [308, 44], [242, 44]]}, {"tokens": ["三", "级", "分", "类"], "bbox": [[377, 22], [443, 22], [443, 44], [377, 44]]}, {"tokens": ["说", "明"], "bbox": [[597, 22], [634, 22], [634, 45], [597, 45]]}, {"tokens": ["B"], "bbox": [[12, 544], [27, 544], [27, 561], [12, 561]]}, {"tokens": [], "bbox": [[107, 67], [143, 67], [143, 185], [107, 185]]}, {"tokens": ["基", "本", "信", "息"], "bbox": [[155, 100], [195, 100], [195, 151], [155, 151]]}, {"tokens": ["4"], "bbox": [[218, 114], [233, 114], [233, 134], [218, 134]]}, {"tokens": ["联", "系", "信", "息"], "bbox": [[250, 113], [315, 113], [315, 135], [250, 135]]}, {"tokens": ["电", "子", "邮", "箱"], "bbox": [[345, 70], [410, 70], [410, 92], [345, 92]]}, {"tokens": ["自", "然", "人", "的", "办", "事", "登", "记", "的", "电", "子", "邮", "箱", "信", "息"], "bbox": [[489, 71], [715, 71], [715, 92], [489, 92]]}, {"tokens": ["联", "系", "地", "址"], "bbox": [[345, 114], [410, 114], [410, 135], [345, 135]]}, {"tokens": ["自", "然", "人", "联", "系", "地", "址", "信", "息"], "bbox": [[489, 114], [625, 114], [625, 135], [489, 135]]}, {"tokens": ["联", "系", "电", "话"], "bbox": [[345, 157], [410, 157], [410, 179], [345, 179]]}, {"tokens": ["自", "然", "人", "的", "电", "话", "信", "息"], "bbox": [[489, 158], [610, 158], [610, 179], [489, 179]]}, {"tokens": ["B"], "bbox": [[118, 432], [131, 432], [131, 446], [118, 446]]}, {"tokens": ["资", "产", "信", "息"], "bbox": [[160, 413], [201, 413], [201, 463], [160, 463]]}, {"tokens": ["1"], "bbox": [[217, 277], [236, 277], [236, 307], [217, 307]]}, {"tokens": ["实", "物", "资", "产"], "bbox": [[250, 278], [315, 278], [315, 299], [250, 299]]}, {"tokens": ["土", "地", "建", "筑", "及", "附", "着", "物"], "bbox": [[346, 202], [469, 202], [469, 226], [346, 226]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "具", "有", "实", "物", "形", "态", "的", "资", "产"], "bbox": [[489, 204], [716, 204], [716, 225], [489, 225]]}, {"tokens": ["装", "备", "及", "设", "备"], "bbox": [[345, 253], [424, 253], [424, 274], [345, 274]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "车", "辆", "、", "设", "备", "等", "资", "产"], "bbox": [[490, 255], [699, 255], [699, 272], [490, 272]]}, {"tokens": ["家", "具", "/", "用", "具", "及", "动", "植", "物"], "bbox": [[345, 291], [473, 291], [473, 337], [345, 337]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "家", "具", "、", "工", "具", ",", "生", "活", "生", "产", "资", "料", "等", "形", "式", "的", "资", "产"], "bbox": [[488, 291], [746, 291], [746, 339], [488, 339]]}, {"tokens": ["资", "产", "处", "置"], "bbox": [[345, 354], [410, 354], [410, 375], [345, 375]]}, {"tokens": ["自", "然", "人", "资", "产", "处", "置", "过", "程", "的", "信", "息"], "bbox": [[488, 354], [671, 354], [671, 375], [488, 375]]}, {"tokens": ["2"], "bbox": [[221, 449], [233, 449], [233, 464], [221, 464]]}, {"tokens": ["无", "形", "资", "产"], "bbox": [[250, 443], [316, 443], [316, 468], [250, 468]]}, {"tokens": ["知", "识", "产", "权"], "bbox": [[344, 403], [409, 403], [409, 424], [344, 424]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "具", "备", "价", "值", "的", "知", "识", "产", "权", "信", "息"], "bbox": [[490, 393], [743, 393], [743, 437], [490, 437]]}, {"tokens": ["信", "息", "数", "据"], "bbox": [[345, 473], [410, 473], [410, 494], [345, 494]]}, {"tokens": ["自", "然", "人", "拥", "有", "或", "者", "控", "制", "的", ",", "不", "具", "有", "特", "定", "实", "物", "形", "态", ",", "能", "持", "续", "发", "挥", "作", "用", "且", "能", "带", "来", "经", "济", "利", "益", "的", "非", "货", "币", "性", "资", "源"], "bbox": [[490, 447], [744, 447], [744, 520], [490, 520]]}, {"tokens": ["3"], "bbox": [[221, 598], [233, 598], [233, 614], [221, 614]]}, {"tokens": ["金", "融", "资", "产"], "bbox": [[250, 593], [316, 593], [316, 617], [250, 617]]}, {"tokens": ["保", "险", "资", "产"], "bbox": [[344, 530], [410, 530], [410, 558], [344, 558]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "保", "险", "类", "资", "产", "的", "总", "称"], "bbox": [[490, 536], [700, 536], [700, 553], [490, 553]]}, {"tokens": ["货", "币", "资", "产"], "bbox": [[342, 570], [411, 570], [411, 597], [342, 597]]}, {"tokens": ["自", "然", "人", "拥", "有", "的", "货", "币", "化", "资", "产", "的", "总", "称"], "bbox": [[490, 575], [700, 575], [700, 593], [490, 593]]}, {"tokens": ["有", "价", "证", "券"], "bbox": [[345, 634], [409, 634], [409, 655], [345, 655]]}, {"tokens": ["自", "然", "人", "可", "以", "在", "有", "组", "织", "的", "金", "融", "市", "场", "上", "进", "行", "交", "易", "、", "具", "有", "现", "实", "价", "格", "和", "未", "来", "估", "价", "的", "金", "融", "工", "具", "的", "总", "称"], "bbox": [[489, 607], [750, 607], [750, 680], [489, 680]]}, {"tokens": ["C"], "bbox": [[117, 851], [131, 851], [131, 879], [117, 879]]}, {"tokens": ["社", "会", "活", "动"], "bbox": [[162, 841], [198, 841], [198, 890], [162, 890]]}, {"tokens": ["1"], "bbox": [[219, 771], [232, 771], [232, 795], [219, 795]]}, {"tokens": ["基", "本", "生", "活"], "bbox": [[250, 773], [315, 773], [315, 794], [250, 794]]}, {"tokens": ["公", "共", "支", "付"], "bbox": [[345, 703], [410, 703], [410, 725], [345, 725]]}, {"tokens": ["自", "然", "人", "在", "日", "常", "生", "活", "中", "的", "金", "融", "支", "付", "相", "关", "信", "息"], "bbox": [[489, 692], [745, 692], [745, 734], [489, 734]]}, {"tokens": ["交", "通", "出", "行"], "bbox": [[343, 757], [409, 757], [409, 782], [343, 782]]}, {"tokens": ["自", "然", "人", "在", "日", "常", "生", "活", "中", "的", "交", "通", "出", "行", "相", "关", "信", "息"], "bbox": [[489, 746], [747, 746], [747, 793], [489, 793]]}, {"tokens": ["旅", "馆", "住", "宿"], "bbox": [[345, 806], [410, 806], [410, 828], [345, 828]]}, {"tokens": ["自", "然", "人", "在", "日", "常", "生", "活", "中", "的", "住", "宿", "相", "关", "信", "息"], "bbox": [[489, 807], [729, 807], [729, 824], [489, 824]]}, {"tokens": ["邮", "政", "物", "流"], "bbox": [[345, 848], [410, 848], [410, 869], [345, 869]]}, {"tokens": ["自", "然", "人", "在", "日", "常", "生", "活", "中", "的", "邮", "寄", "相", "关", "信", "息"], "bbox": [[490, 850], [730, 850], [730, 867], [490, 867]]}, {"tokens": ["2"], "bbox": [[221, 954], [233, 954], [233, 969], [221, 969]]}, {"tokens": ["医", "疗", "、", "卫", "生"], "bbox": [[250, 895], [330, 895], [330, 916], [250, 916]]}, {"tokens": ["计", "生", "信", "息"], "bbox": [[345, 895], [409, 895], [409, 917], [345, 917]]}, {"tokens": ["自", "然", "人", "在", "生", "理", "健", "康", "方", "面", "相", "关", "的", "活", "动"], "bbox": [[490, 897], [715, 897], [715, 914], [490, 914]]}, {"tokens": [], "bbox": [[250, 938], [330, 938], [330, 1039], [250, 1039]]}, {"tokens": ["检", "查", "与", "检", "验", "信", "息"], "bbox": [[345, 949], [454, 949], [454, 969], [345, 969]]}, {"tokens": ["自", "然", "人", "在", "卫", "生", "医", "疗", "机", "进", "行", "构", "检", "查", "与", "检", "验", "的", "信", "息"], "bbox": [[488, 936], [748, 936], [748, 982], [488, 982]]}, {"tokens": ["自", "然", "人", "在", "卫", "生", "医", "疗", "机", "构", "进", "行", "门", "诊", "与", "住", "院", "的", "相", "关", "活", "动"], "bbox": [[489, 992], [744, 992], [744, 1039], [489, 1039]]}, {"tokens": ["门", "诊", "与", "住", "院", "信", "息"], "bbox": [[345, 1005], [454, 1005], [454, 1025], [345, 1025]]}]}, "gt": "<html><body><table><tbody><tr><td>分面</td><td colspan=\"2\">一级分类</td><td colspan=\"2\">二级分类</td><td>三级分类</td><td>说明</td></tr><tr><td rowspan=\"1\">B</td><td rowspan=\"3\"></td><td rowspan=\"3\">基本信息</td><td rowspan=\"3\">4</td><td rowspan=\"3\">联系信息</td><td>电子邮箱</td><td>自然人的办事登记的电子邮箱信息</td></tr><tr><td>联系地址</td><td>自然人联系地址信息</td></tr><tr><td>联系电话</td><td>自然人的电话信息</td></tr><tr><td rowspan=\"9\">B</td><td rowspan=\"9\">资产信息</td><td rowspan=\"4\">1</td><td rowspan=\"4\">实物资产</td><td>土地建筑及附着物</td><td>自然人拥有的具有实物形态的资产</td></tr><tr><td>装备及设备</td><td>自然人拥有的车辆、设备等资产</td></tr><tr><td>家具/用具及动植物</td><td>自然人拥有的家具、工具,生活生产资料等形式的资产</td></tr><tr><td>资产处置</td><td>自然人资产处置过程的信息</td></tr><tr><td rowspan=\"2\">2</td><td rowspan=\"2\">无形资产</td><td>知识产权</td><td>自然人拥有的具备价值的知识产权信息</td></tr><tr><td>信息数据</td><td>自然人拥有或者控制的,不具有特定实物形态,能持续发挥作用且能带来经济利益的非货币性资源</td></tr><tr><td rowspan=\"3\">3</td><td rowspan=\"3\">金融资产</td><td>保险资产</td><td>自然人拥有的保险类资产的总称</td></tr><tr><td>货币资产</td><td>自然人拥有的货币化资产的总称</td></tr><tr><td>有价证券</td><td>自然人可以在有组织的金融市场上进行交易、具有现实价格和未来估价的金融工具的总称</td></tr><tr><td rowspan=\"7\">C</td><td rowspan=\"7\">社会活动</td><td rowspan=\"4\">1</td><td rowspan=\"4\">基本生活</td><td>公共支付</td><td>自然人在日常生活中的金融支付相关信息</td></tr><tr><td>交通出行</td><td>自然人在日常生活中的交通出行相关信息</td></tr><tr><td>旅馆住宿</td><td>自然人在日常生活中的住宿相关信息</td></tr><tr><td>邮政物流</td><td>自然人在日常生活中的邮寄相关信息</td></tr><tr><td rowspan=\"3\">2</td><td>医疗、卫生</td><td>计生信息</td><td>自然人在生理健康方面相关的活动</td></tr><tr><td rowspan=\"2\"></td><td>检查与检验信息</td><td>自然人在卫生医疗机进行构检查与检验的信息</td></tr><tr><td>自然人在卫生医疗机构进行门诊与住院的相关活动</td><td>门诊与住院信息</td></tr></tbody></table></body></html>"}
我将该JSON中gt字段复制到html文件中打开,以查看标注是否正确。得到了下边的这幅图
我在[1]处加入border=1以便更好观察cell情况,并且发现在[2]处的标签的rowspan值有问题将他修改为正确的rowspan=19后表格的结构就恢复正常了。
在之后的尝试中,我发现合并了9个单元格及以下的图像都没问题;合并了11个单元格及以上的都有问题,并且都将超过了一定长度的单元格的长度设置为了1,只要把这个单元格长度手动改为大于等于其真实值,就没问题了。
是否PPOCRLabel在表格识别导出中存在单元格合并最大长度限制。
Beta Was this translation helpful? Give feedback.
All reactions