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

Minor changes

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. postprocess.py +2 -2
app.py CHANGED
@@ -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.5]
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)
 
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)
postprocess.py CHANGED
@@ -199,8 +199,8 @@ def nms_by_containment(container_objects, package_objects, overlap_threshold=0.5
199
  if not suppression[object1_num]:
200
  object1_packages = set(packages_by_container[object1_num])
201
  if len(object2_packages.intersection(object1_packages)) > 0 \
202
- and (iob(container_objects[object2_num]['bbox'], container_objects[object1_num]['bbox']) > 0.5 \
203
- or iob(container_objects[object1_num]['bbox'], container_objects[object2_num]['bbox']) > 0.5):
204
  suppression[object2_num] = True
205
 
206
  final_objects = [obj for idx, obj in enumerate(container_objects) if not suppression[idx]]
 
199
  if not suppression[object1_num]:
200
  object1_packages = set(packages_by_container[object1_num])
201
  if len(object2_packages.intersection(object1_packages)) > 0 \
202
+ and (iob(container_objects[object2_num]['bbox'], container_objects[object1_num]['bbox']) >= 0.5 \
203
+ or iob(container_objects[object1_num]['bbox'], container_objects[object2_num]['bbox']) >= 0.5):
204
  suppression[object2_num] = True
205
 
206
  final_objects = [obj for idx, obj in enumerate(container_objects) if not suppression[idx]]