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
paddle_dbnet
Commits
7d472831
"vscode:/vscode.git/clone" did not exist on "f6e8c8c09cb476b59c2d28c6fd7a969dee575164"
Commit
7d472831
authored
Jun 10, 2021
by
WenmuZhou
Browse files
support model link in model_dir params
parent
037e17fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
paddleocr.py
paddleocr.py
+14
-15
No files found.
paddleocr.py
View file @
7d472831
...
...
@@ -28,7 +28,7 @@ from ppocr.utils.logging import get_logger
logger
=
get_logger
()
from
ppocr.utils.utility
import
check_and_read_gif
,
get_image_file_list
from
ppocr.utils.network
import
maybe_download
,
download_with_progressbar
from
ppocr.utils.network
import
maybe_download
,
download_with_progressbar
,
is_link
,
confirm_model_dir_url
from
tools.infer.utility
import
draw_ocr
,
init_args
,
str2bool
__all__
=
[
'PaddleOCR'
]
...
...
@@ -192,20 +192,19 @@ class PaddleOCR(predict_system.TextSystem):
'dict_path'
]
# init model dir
if
params
.
det_model_dir
is
None
:
params
.
det_model_dir
=
os
.
path
.
join
(
BASE_DIR
,
VERSION
,
'det'
,
det_lang
)
if
params
.
rec_model_dir
is
None
:
params
.
rec_model_dir
=
os
.
path
.
join
(
BASE_DIR
,
VERSION
,
'rec'
,
lang
)
if
params
.
cls_model_dir
is
None
:
params
.
cls_model_dir
=
os
.
path
.
join
(
BASE_DIR
,
'cls'
)
params
.
det_model_dir
,
det_url
=
confirm_model_dir_url
(
params
.
det_model_dir
,
os
.
path
.
join
(
BASE_DIR
,
VERSION
,
'det'
,
det_lang
),
model_urls
[
'det'
][
det_lang
])
params
.
rec_model_dir
,
rec_url
=
confirm_model_dir_url
(
params
.
rec_model_dir
,
os
.
path
.
join
(
BASE_DIR
,
VERSION
,
'rec'
,
lang
),
model_urls
[
'rec'
][
lang
][
'url'
])
params
.
cls_model_dir
,
cls_url
=
confirm_model_dir_url
(
params
.
cls_model_dir
,
os
.
path
.
join
(
BASE_DIR
,
VERSION
,
'cls'
),
model_urls
[
'cls'
])
# download model
maybe_download
(
params
.
det_model_dir
,
model_urls
[
'det'
][
det_lang
])
maybe_download
(
params
.
rec_model_dir
,
model_urls
[
'rec'
][
lang
][
'url'
])
maybe_download
(
params
.
cls_model_dir
,
model_urls
[
'cls'
])
maybe_download
(
params
.
det_model_dir
,
det_url
)
maybe_download
(
params
.
rec_model_dir
,
rec_url
)
maybe_download
(
params
.
cls_model_dir
,
cls_url
)
if
params
.
det_algorithm
not
in
SUPPORT_DET_MODEL
:
logger
.
error
(
'det_algorithm must in {}'
.
format
(
SUPPORT_DET_MODEL
))
...
...
@@ -277,7 +276,7 @@ def main():
# for cmd
args
=
parse_args
(
mMain
=
True
)
image_dir
=
args
.
image_dir
if
image_dir
.
startswith
(
'http'
):
if
i
s_link
(
i
mage_dir
):
download_with_progressbar
(
image_dir
,
'tmp.jpg'
)
image_file_list
=
[
'tmp.jpg'
]
else
:
...
...
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