Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
a9d70931
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a9d70931
编写于
11月 21, 2020
作者:
S
shaohua.zhang
提交者:
GitHub
11月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some errors and bugs (#1185)
fix some errors in pip
上级
03616470
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
8 addition
and
12 deletion
+8
-12
paddleocr.py
paddleocr.py
+8
-12
未找到文件。
paddleocr.py
浏览文件 @
a9d70931
...
@@ -87,8 +87,8 @@ def download_with_progressbar(url, save_path):
...
@@ -87,8 +87,8 @@ def download_with_progressbar(url, save_path):
progress_bar
.
update
(
len
(
data
))
progress_bar
.
update
(
len
(
data
))
file
.
write
(
data
)
file
.
write
(
data
)
progress_bar
.
close
()
progress_bar
.
close
()
if
total_size_in_bytes
!=
0
and
progress_bar
.
n
!=
total_size_in_bytes
:
if
total_size_in_bytes
==
0
or
progress_bar
.
n
!=
total_size_in_bytes
:
logger
.
error
(
"
ERROR, something went wrong
"
)
logger
.
error
(
"
Something went wrong while downloading models
"
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -157,7 +157,6 @@ def parse_args():
...
@@ -157,7 +157,6 @@ def parse_args():
parser
.
add_argument
(
"--use_space_char"
,
type
=
bool
,
default
=
True
)
parser
.
add_argument
(
"--use_space_char"
,
type
=
bool
,
default
=
True
)
# params for text classifier
# params for text classifier
parser
.
add_argument
(
"--use_angle_cls"
,
type
=
str2bool
,
default
=
False
)
parser
.
add_argument
(
"--cls_model_dir"
,
type
=
str
,
default
=
None
)
parser
.
add_argument
(
"--cls_model_dir"
,
type
=
str
,
default
=
None
)
parser
.
add_argument
(
"--cls_image_shape"
,
type
=
str
,
default
=
"3, 48, 192"
)
parser
.
add_argument
(
"--cls_image_shape"
,
type
=
str
,
default
=
"3, 48, 192"
)
parser
.
add_argument
(
"--label_list"
,
type
=
list
,
default
=
[
'0'
,
'180'
])
parser
.
add_argument
(
"--label_list"
,
type
=
list
,
default
=
[
'0'
,
'180'
])
...
@@ -171,7 +170,7 @@ def parse_args():
...
@@ -171,7 +170,7 @@ def parse_args():
parser
.
add_argument
(
"--lang"
,
type
=
str
,
default
=
'ch'
)
parser
.
add_argument
(
"--lang"
,
type
=
str
,
default
=
'ch'
)
parser
.
add_argument
(
"--det"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--det"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--rec"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--rec"
,
type
=
str2bool
,
default
=
True
)
parser
.
add_argument
(
"--
cls"
,
type
=
str2bool
,
default
=
Fals
e
)
parser
.
add_argument
(
"--
use_angle_cls"
,
type
=
str2bool
,
default
=
Tru
e
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -206,7 +205,6 @@ class PaddleOCR(predict_system.TextSystem):
...
@@ -206,7 +205,6 @@ class PaddleOCR(predict_system.TextSystem):
maybe_download
(
postprocess_params
.
det_model_dir
,
model_urls
[
'det'
])
maybe_download
(
postprocess_params
.
det_model_dir
,
model_urls
[
'det'
])
maybe_download
(
postprocess_params
.
rec_model_dir
,
maybe_download
(
postprocess_params
.
rec_model_dir
,
model_urls
[
'rec'
][
lang
][
'url'
])
model_urls
[
'rec'
][
lang
][
'url'
])
if
self
.
use_angle_cls
:
maybe_download
(
postprocess_params
.
cls_model_dir
,
model_urls
[
'cls'
])
maybe_download
(
postprocess_params
.
cls_model_dir
,
model_urls
[
'cls'
])
if
postprocess_params
.
det_algorithm
not
in
SUPPORT_DET_MODEL
:
if
postprocess_params
.
det_algorithm
not
in
SUPPORT_DET_MODEL
:
...
@@ -231,9 +229,6 @@ class PaddleOCR(predict_system.TextSystem):
...
@@ -231,9 +229,6 @@ class PaddleOCR(predict_system.TextSystem):
rec: use text recognition or not, if false, only det will be exec. default is True
rec: use text recognition or not, if false, only det will be exec. default is True
"""
"""
assert
isinstance
(
img
,
(
np
.
ndarray
,
list
,
str
))
assert
isinstance
(
img
,
(
np
.
ndarray
,
list
,
str
))
if
cls
and
not
self
.
use_angle_cls
:
print
(
'cls should be false when use_angle_cls is false'
)
exit
(
-
1
)
self
.
use_angle_cls
=
cls
self
.
use_angle_cls
=
cls
if
isinstance
(
img
,
str
):
if
isinstance
(
img
,
str
):
image_file
=
img
image_file
=
img
...
@@ -275,6 +270,7 @@ def main():
...
@@ -275,6 +270,7 @@ def main():
result
=
ocr_engine
.
ocr
(
img_path
,
result
=
ocr_engine
.
ocr
(
img_path
,
det
=
args
.
det
,
det
=
args
.
det
,
rec
=
args
.
rec
,
rec
=
args
.
rec
,
cls
=
args
.
cls
)
cls
=
args
.
use_angle_cls
)
if
result
is
not
None
:
for
line
in
result
:
for
line
in
result
:
print
(
line
)
print
(
line
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录