bachpc commited on
Commit
6b58b11
·
1 Parent(s): 17fe3ec

Minor changes

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -83,7 +83,7 @@ def table_detection(pil_img, imgsz=640):
83
  image = PIL_to_cv(pil_img)
84
  pred = detection_model(image, size=imgsz)
85
  pred = pred.xywhn[0]
86
- result = pred.cpu().numpy()
87
  return result
88
 
89
 
@@ -91,7 +91,7 @@ def table_structure(pil_img, imgsz=640):
91
  image = PIL_to_cv(pil_img)
92
  pred = structure_model(image, size=imgsz)
93
  pred = pred.xywhn[0]
94
- result = pred.cpu().numpy()
95
  return result
96
 
97
 
@@ -211,7 +211,7 @@ def convert_stucture(page_tokens, pil_img, structure_result):
211
  # print('table_class_objects:', table_class_objects)
212
  # print('table_bbox:', table_bbox)
213
 
214
- tokens_in_table = [token for token in page_tokens if postprocess.iob(token['bbox'], table_bbox) >= 0.01]
215
  # print('tokens_in_table:', tokens_in_table)
216
 
217
  table_structures, cells, confidence_score = postprocess.objects_to_cells(table, table_objects, tokens_in_table, structure_class_names, structure_class_thresholds)
 
83
  image = PIL_to_cv(pil_img)
84
  pred = detection_model(image, size=imgsz)
85
  pred = pred.xywhn[0]
86
+ result = pred.detach().cpu().numpy()
87
  return result
88
 
89
 
 
91
  image = PIL_to_cv(pil_img)
92
  pred = structure_model(image, size=imgsz)
93
  pred = pred.xywhn[0]
94
+ result = pred.detach().cpu().numpy()
95
  return result
96
 
97
 
 
211
  # print('table_class_objects:', table_class_objects)
212
  # print('table_bbox:', table_bbox)
213
 
214
+ tokens_in_table = [token for token in page_tokens if postprocess.iob(token['bbox'], table_bbox) >= 0.001]
215
  # print('tokens_in_table:', tokens_in_table)
216
 
217
  table_structures, cells, confidence_score = postprocess.objects_to_cells(table, table_objects, tokens_in_table, structure_class_names, structure_class_thresholds)