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
3f22cb60
Unverified
Commit
3f22cb60
authored
Feb 18, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Feb 18, 2025
Browse files
Merge pull request #1703 from icecraft/fix/caption_match
Fix/caption match
parents
d46b87be
f731fcab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
magic_pdf/model/magic_model.py
magic_pdf/model/magic_model.py
+30
-18
No files found.
magic_pdf/model/magic_model.py
View file @
3f22cb60
...
...
@@ -519,15 +519,27 @@ class MagicModel:
if
nxt
is
None
:
break
seen_idx
.
add
(
fst_idx
)
seen_idx
.
add
(
nxt
[
0
])
if
fst_kind
==
SUB_BIT_KIND
:
seen_sub_idx
.
add
(
fst_idx
)
sub_idx
,
obj_idx
=
fst_idx
,
nxt
[
0
]
-
OBJ_IDX_OFFSET
else
:
seen_sub_idx
.
add
(
nxt
[
0
])
sub_idx
,
obj_idx
=
nxt
[
0
],
fst_idx
-
OBJ_IDX_OFFSET
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
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
)
ret
.
append
(
{
'sub_bbox'
:
{
...
...
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