From 1c0870de5192e6ddf28006861f1aea862e593676 Mon Sep 17 00:00:00 2001 From: alanhsu777 Date: Tue, 28 Oct 2025 10:18:42 +0800 Subject: [PATCH 1/2] fix: the table index is obtained by calculating the overlap ratio between the bounding boxes of the tables. --- paddlex/inference/pipelines/layout_parsing/pipeline_v2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py b/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py index 5efa71910..4d07292d6 100644 --- a/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py +++ b/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py @@ -689,11 +689,10 @@ def get_layout_parsing_objects( - "block_bbox": The coordinates of the layout box. """ - table_index = 0 + table_bboxes = [calculate_minimum_enclosing_bbox(table_res["cell_box_list"]) for table_res in table_res_list] if table_res_list else [] seal_index = 0 chart_index = 0 layout_parsing_blocks: List[LayoutBlock] = [] - for box_idx, box_info in enumerate(layout_det_res["boxes"]): label = box_info["label"] @@ -703,8 +702,10 @@ def get_layout_parsing_objects( block = LayoutBlock(label=label, bbox=block_bbox) if label == "table" and len(table_res_list) > 0: + # The table index is obtained by calculating the overlap ratio between the bounding boxes of the tables. + table_overlap_ratio_list = [calculate_overlap_ratio(bbox1=block_bbox, bbox2=table_bbox) for table_bbox in table_bboxes] + table_index, table_overlap_ratio = max(enumerate(table_overlap_ratio_list), key=lambda x: x[1]) block.content = table_res_list[table_index]["pred_html"] - table_index += 1 elif label == "seal" and len(seal_res_list) > 0: block.content = "\n".join(seal_res_list[seal_index]["rec_texts"]) seal_index += 1 From 3f934a9b0417b922f0438dd9085b16e54ffc9afa Mon Sep 17 00:00:00 2001 From: alanhsu777 Date: Tue, 4 Nov 2025 14:58:01 +0800 Subject: [PATCH 2/2] fix: the table index is obtained by calculating the overlap ratio between the bounding boxes of the tables. --- paddlex/inference/pipelines/layout_parsing/pipeline_v2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py b/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py index 4d07292d6..8944baedd 100644 --- a/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py +++ b/paddlex/inference/pipelines/layout_parsing/pipeline_v2.py @@ -689,7 +689,12 @@ def get_layout_parsing_objects( - "block_bbox": The coordinates of the layout box. """ - table_bboxes = [calculate_minimum_enclosing_bbox(table_res["cell_box_list"]) for table_res in table_res_list] if table_res_list else [] + table_cell_bboxes_list = [ + [[int(pos) for pos in box] for box in table_res["cell_box_list"]] + for table_res in table_res_list + ] if table_res_list else [] + table_bboxes = [calculate_minimum_enclosing_bbox(table_cell_bboxes) + for table_cell_bboxes in table_cell_bboxes_list] seal_index = 0 chart_index = 0 layout_parsing_blocks: List[LayoutBlock] = []