From fb02be19c95c5627dcd228bd251b936032ff2013 Mon Sep 17 00:00:00 2001 From: icecraft Date: Mon, 3 Mar 2025 17:08:17 +0800 Subject: [PATCH] fix: caption match --- magic_pdf/model/magic_model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/magic_pdf/model/magic_model.py b/magic_pdf/model/magic_model.py index 0f4be48e..b5922d35 100644 --- a/magic_pdf/model/magic_model.py +++ b/magic_pdf/model/magic_model.py @@ -528,14 +528,13 @@ def __tie_up_category_by_distance_v3( pair_dis = bbox_distance(subjects[sub_idx]['bbox'], objects[obj_idx]['bbox']) nearest_dis = float('inf') for i in range(N): - if i in seen_idx:continue + if i in seen_idx or i == sub_idx:continue nearest_dis = min(nearest_dis, bbox_distance(subjects[i]['bbox'], objects[obj_idx]['bbox'])) if pair_dis >= 3*nearest_dis: seen_idx.add(sub_idx) continue - seen_idx.add(sub_idx) seen_idx.add(obj_idx + OBJ_IDX_OFFSET) seen_sub_idx.add(sub_idx)