关于paddleocr的predict_system按高度顺序画图,(coco格式)
增加adjust_res函数:
实现代码:
def adjust_res(res):
res_cp = deepcopy(res)
res_cp = sorted(res_cp, key=lambda x: x['bbox'][1], reverse=False)
return res
通过浅拷贝对table类型增加编号,:
def adjust_res(res):
res_cp = deepcopy(res)
res_cp = sorted(res_cp, key=lambda x: x['bbox'][1], reverse=False)
mask = 0
for region in res_cp:
if region['type'] == 'table':
mask += 1
region['type'] = ''.join(['table',str(mask)])
# print(res_cp)
return res_cp
Utility.py修改:
# if region['type'] == 'table':
if 'table' in region['type']: