Skip to content

Commit f20ab37

Browse files
authored
Merge pull request #1822 from icecraft/fix/caption_match
fix: caption match
2 parents 98adcbb + fb02be1 commit f20ab37

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

magic_pdf/model/magic_model.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,13 @@ def __tie_up_category_by_distance_v3(
528528
pair_dis = bbox_distance(subjects[sub_idx]['bbox'], objects[obj_idx]['bbox'])
529529
nearest_dis = float('inf')
530530
for i in range(N):
531-
if i in seen_idx:continue
531+
if i in seen_idx or i == sub_idx:continue
532532
nearest_dis = min(nearest_dis, bbox_distance(subjects[i]['bbox'], objects[obj_idx]['bbox']))
533533

534534
if pair_dis >= 3*nearest_dis:
535535
seen_idx.add(sub_idx)
536536
continue
537537

538-
539538
seen_idx.add(sub_idx)
540539
seen_idx.add(obj_idx + OBJ_IDX_OFFSET)
541540
seen_sub_idx.add(sub_idx)

0 commit comments

Comments
 (0)