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
241d4895
Unverified
Commit
241d4895
authored
Nov 22, 2024
by
Xiaomeng Zhao
Committed by
GitHub
Nov 22, 2024
Browse files
Merge pull request #1061 from myhloli/dev
refactor(model): move page total time logging to custom model analysis
parents
0d632833
f1e2f084
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
magic_pdf/model/doc_analyze_by_custom_model.py
magic_pdf/model/doc_analyze_by_custom_model.py
+2
-0
magic_pdf/model/pdf_extract_kit.py
magic_pdf/model/pdf_extract_kit.py
+0
-3
No files found.
magic_pdf/model/doc_analyze_by_custom_model.py
View file @
241d4895
...
@@ -163,7 +163,9 @@ def doc_analyze(pdf_bytes: bytes, ocr: bool = False, show_log: bool = False,
...
@@ -163,7 +163,9 @@ def doc_analyze(pdf_bytes: bytes, ocr: bool = False, show_log: bool = False,
page_width
=
img_dict
[
"width"
]
page_width
=
img_dict
[
"width"
]
page_height
=
img_dict
[
"height"
]
page_height
=
img_dict
[
"height"
]
if
start_page_id
<=
index
<=
end_page_id
:
if
start_page_id
<=
index
<=
end_page_id
:
page_start
=
time
.
time
()
result
=
custom_model
(
img
)
result
=
custom_model
(
img
)
logger
.
info
(
f
'-----page_id :
{
index
}
, page total time:
{
round
(
time
.
time
()
-
page_start
,
2
)
}
-----'
)
else
:
else
:
result
=
[]
result
=
[]
page_info
=
{
"page_no"
:
index
,
"height"
:
page_height
,
"width"
:
page_width
}
page_info
=
{
"page_no"
:
index
,
"height"
:
page_height
,
"width"
:
page_width
}
...
...
magic_pdf/model/pdf_extract_kit.py
View file @
241d4895
...
@@ -170,7 +170,6 @@ class CustomPEKModel:
...
@@ -170,7 +170,6 @@ class CustomPEKModel:
logger
.
info
(
'DocAnalysis init done!'
)
logger
.
info
(
'DocAnalysis init done!'
)
def
__call__
(
self
,
image
):
def
__call__
(
self
,
image
):
page_start
=
time
.
time
()
# layout检测
# layout检测
layout_start
=
time
.
time
()
layout_start
=
time
.
time
()
...
@@ -272,6 +271,4 @@ class CustomPEKModel:
...
@@ -272,6 +271,4 @@ class CustomPEKModel:
)
)
logger
.
info
(
f
'table time:
{
round
(
time
.
time
()
-
table_start
,
2
)
}
'
)
logger
.
info
(
f
'table time:
{
round
(
time
.
time
()
-
table_start
,
2
)
}
'
)
logger
.
info
(
f
'-----page total time:
{
round
(
time
.
time
()
-
page_start
,
2
)
}
-----'
)
return
layout_res
return
layout_res
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