6eabf0e2 by 周伟奇

Merge branch 'feature/SE'

2 parents dd5053eb 133b0683
......@@ -8,6 +8,26 @@
import re
import numpy as np
from fuzzywuzzy import fuzz
from shapely.geometry import Polygon
def caculate_iou(g, p):
g = Polygon(np.array(g).reshape((-1, 2)))
p = Polygon(np.array(p).reshape((-1, 2)))
inter = Polygon(g).intersection(Polygon(p)).area
union = g.area + p.area - inter
return inter/union
def get_table_info(bbox_1, bbox_2, ocr_result):
anchor = [bbox_2[0], bbox_1[1], bbox_2[2], bbox_1[3],
bbox_2[4], bbox_1[5], bbox_2[6], bbox_1[7]]
table_info = ''
for span in ocr_result:
iou = caculate_iou(anchor, span[0])
if iou > 0:
table_info = span[1]
return table_info
class Finder:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!