Browse Source

feat: update table bounding box calculation in enhance_table_html_with_bbox method to use relative coordinates for improved accuracy in cell matching

zhch158_admin 1 tuần trước cách đây
mục cha
commit
927beae129
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      zhch/universal_doc_parser/core/element_processors.py

+ 2 - 1
zhch/universal_doc_parser/core/element_processors.py

@@ -291,11 +291,12 @@ class ElementProcessors:
         
         if table_html and ocr_boxes and self.table_cell_matcher:
             try:
+                # bbox是table相对于整页图片的bbox,table_bbox需要传入相对坐标
                 enhanced_html, cells, _, skew_angle = self.table_cell_matcher.enhance_table_html_with_bbox(
                     html=table_html,
                     paddle_text_boxes=ocr_boxes,
                     start_pointer=0,
-                    table_bbox=None
+                    table_bbox=[0, 0, bbox[2] - bbox[0], bbox[3] - bbox[1]]
                 )
                 logger.info(f"📊 Matched {len(cells)} cells with coordinates (skew: {skew_angle:.2f}°)")
             except Exception as e: