Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
7e8cb108
Unverified
Commit
7e8cb108
authored
Jul 22, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Jul 22, 2025
Browse files
Merge pull request #3129 from huazZeng/master
improve the caption match algorithm
parents
b25f42a2
300b6917
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
mineru/backend/pipeline/pipeline_magic_model.py
mineru/backend/pipeline/pipeline_magic_model.py
+4
-2
No files found.
mineru/backend/pipeline/pipeline_magic_model.py
View file @
7e8cb108
...
@@ -275,7 +275,8 @@ class MagicModel:
...
@@ -275,7 +275,8 @@ class MagicModel:
fst_idx
,
fst_kind
,
left_x
,
top_y
=
candidates
[
0
]
fst_idx
,
fst_kind
,
left_x
,
top_y
=
candidates
[
0
]
candidates
.
sort
(
key
=
lambda
x
:
(
x
[
2
]
-
left_x
)
**
2
+
(
x
[
3
]
-
top_y
)
**
2
)
fst_bbox
=
subjects
[
fst_idx
][
'bbox'
]
if
fst_kind
==
SUB_BIT_KIND
else
objects
[
fst_idx
-
OBJ_IDX_OFFSET
][
'bbox'
]
candidates
.
sort
(
key
=
lambda
x
:
bbox_distance
(
fst_bbox
,
subjects
[
x
[
0
]][
'bbox'
])
if
x
[
1
]
==
SUB_BIT_KIND
else
bbox_distance
(
fst_bbox
,
objects
[
x
[
0
]
-
OBJ_IDX_OFFSET
][
'bbox'
]))
nxt
=
None
nxt
=
None
for
i
in
range
(
1
,
len
(
candidates
)):
for
i
in
range
(
1
,
len
(
candidates
)):
...
@@ -294,7 +295,8 @@ class MagicModel:
...
@@ -294,7 +295,8 @@ class MagicModel:
pair_dis
=
bbox_distance
(
subjects
[
sub_idx
][
'bbox'
],
objects
[
obj_idx
][
'bbox'
])
pair_dis
=
bbox_distance
(
subjects
[
sub_idx
][
'bbox'
],
objects
[
obj_idx
][
'bbox'
])
nearest_dis
=
float
(
'inf'
)
nearest_dis
=
float
(
'inf'
)
for
i
in
range
(
N
):
for
i
in
range
(
N
):
if
i
in
seen_idx
or
i
==
sub_idx
:
continue
# 取消原先算法中 1对1 匹配的偏置
# if i in seen_idx or i == sub_idx:continue
nearest_dis
=
min
(
nearest_dis
,
bbox_distance
(
subjects
[
i
][
'bbox'
],
objects
[
obj_idx
][
'bbox'
]))
nearest_dis
=
min
(
nearest_dis
,
bbox_distance
(
subjects
[
i
][
'bbox'
],
objects
[
obj_idx
][
'bbox'
]))
if
pair_dis
>=
3
*
nearest_dis
:
if
pair_dis
>=
3
*
nearest_dis
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment