Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
5eee98f5
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看板
未验证
提交
5eee98f5
编写于
4月 24, 2021
作者:
M
MissPenguin
提交者:
GitHub
4月 24, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2612 from littletomatodonkey/2.1/fix_hub_post
fix hub serving for db post process
上级
7b759798
d0e4101b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
8 deletion
+75
-8
deploy/hubserving/ocr_cls/module.py
deploy/hubserving/ocr_cls/module.py
+18
-2
deploy/hubserving/ocr_det/module.py
deploy/hubserving/ocr_det/module.py
+19
-2
deploy/hubserving/ocr_det/params.py
deploy/hubserving/ocr_det/params.py
+1
-0
deploy/hubserving/ocr_rec/module.py
deploy/hubserving/ocr_rec/module.py
+18
-2
deploy/hubserving/ocr_system/module.py
deploy/hubserving/ocr_system/module.py
+18
-2
deploy/hubserving/ocr_system/params.py
deploy/hubserving/ocr_system/params.py
+1
-0
未找到文件。
deploy/hubserving/ocr_cls/module.py
浏览文件 @
5eee98f5
...
...
@@ -6,6 +6,7 @@ from __future__ import print_function
import
os
import
sys
sys
.
path
.
insert
(
0
,
"."
)
import
copy
from
paddlehub.common.logger
import
logger
from
paddlehub.module.module
import
moduleinfo
,
runnable
,
serving
...
...
@@ -14,6 +15,7 @@ import paddlehub as hub
from
tools.infer.utility
import
base64_to_cv2
from
tools.infer.predict_cls
import
TextClassifier
from
tools.infer.utility
import
parse_args
@
moduleinfo
(
...
...
@@ -28,8 +30,7 @@ class OCRCls(hub.Module):
"""
initialize with the necessary elements
"""
from
ocr_cls.params
import
read_params
cfg
=
read_params
()
cfg
=
self
.
merge_configs
()
cfg
.
use_gpu
=
use_gpu
if
use_gpu
:
...
...
@@ -48,6 +49,21 @@ class OCRCls(hub.Module):
self
.
text_classifier
=
TextClassifier
(
cfg
)
def
merge_configs
(
self
,
):
# deafult cfg
backup_argv
=
copy
.
deepcopy
(
sys
.
argv
)
sys
.
argv
=
sys
.
argv
[:
1
]
cfg
=
parse_args
()
from
ocr_det.params
import
read_params
update_cfg_map
=
vars
(
read_params
())
for
key
in
update_cfg_map
:
cfg
.
__setattr__
(
key
,
update_cfg_map
[
key
])
sys
.
argv
=
copy
.
deepcopy
(
backup_argv
)
return
cfg
def
read_images
(
self
,
paths
=
[]):
images
=
[]
for
img_path
in
paths
:
...
...
deploy/hubserving/ocr_det/module.py
浏览文件 @
5eee98f5
...
...
@@ -7,6 +7,8 @@ import os
import
sys
sys
.
path
.
insert
(
0
,
"."
)
import
copy
from
paddlehub.common.logger
import
logger
from
paddlehub.module.module
import
moduleinfo
,
runnable
,
serving
import
cv2
...
...
@@ -15,6 +17,7 @@ import paddlehub as hub
from
tools.infer.utility
import
base64_to_cv2
from
tools.infer.predict_det
import
TextDetector
from
tools.infer.utility
import
parse_args
@
moduleinfo
(
...
...
@@ -29,8 +32,7 @@ class OCRDet(hub.Module):
"""
initialize with the necessary elements
"""
from
ocr_det.params
import
read_params
cfg
=
read_params
()
cfg
=
self
.
merge_configs
()
cfg
.
use_gpu
=
use_gpu
if
use_gpu
:
...
...
@@ -49,6 +51,21 @@ class OCRDet(hub.Module):
self
.
text_detector
=
TextDetector
(
cfg
)
def
merge_configs
(
self
,
):
# deafult cfg
backup_argv
=
copy
.
deepcopy
(
sys
.
argv
)
sys
.
argv
=
sys
.
argv
[:
1
]
cfg
=
parse_args
()
from
ocr_det.params
import
read_params
update_cfg_map
=
vars
(
read_params
())
for
key
in
update_cfg_map
:
cfg
.
__setattr__
(
key
,
update_cfg_map
[
key
])
sys
.
argv
=
copy
.
deepcopy
(
backup_argv
)
return
cfg
def
read_images
(
self
,
paths
=
[]):
images
=
[]
for
img_path
in
paths
:
...
...
deploy/hubserving/ocr_det/params.py
浏览文件 @
5eee98f5
...
...
@@ -22,6 +22,7 @@ def read_params():
cfg
.
det_db_box_thresh
=
0.5
cfg
.
det_db_unclip_ratio
=
1.6
cfg
.
use_dilation
=
False
cfg
.
det_db_score_mode
=
"fast"
# #EAST parmas
# cfg.det_east_score_thresh = 0.8
...
...
deploy/hubserving/ocr_rec/module.py
浏览文件 @
5eee98f5
...
...
@@ -6,6 +6,7 @@ from __future__ import print_function
import
os
import
sys
sys
.
path
.
insert
(
0
,
"."
)
import
copy
from
paddlehub.common.logger
import
logger
from
paddlehub.module.module
import
moduleinfo
,
runnable
,
serving
...
...
@@ -14,6 +15,7 @@ import paddlehub as hub
from
tools.infer.utility
import
base64_to_cv2
from
tools.infer.predict_rec
import
TextRecognizer
from
tools.infer.utility
import
parse_args
@
moduleinfo
(
...
...
@@ -28,8 +30,7 @@ class OCRRec(hub.Module):
"""
initialize with the necessary elements
"""
from
ocr_rec.params
import
read_params
cfg
=
read_params
()
cfg
=
self
.
merge_configs
()
cfg
.
use_gpu
=
use_gpu
if
use_gpu
:
...
...
@@ -48,6 +49,21 @@ class OCRRec(hub.Module):
self
.
text_recognizer
=
TextRecognizer
(
cfg
)
def
merge_configs
(
self
,
):
# deafult cfg
backup_argv
=
copy
.
deepcopy
(
sys
.
argv
)
sys
.
argv
=
sys
.
argv
[:
1
]
cfg
=
parse_args
()
from
ocr_det.params
import
read_params
update_cfg_map
=
vars
(
read_params
())
for
key
in
update_cfg_map
:
cfg
.
__setattr__
(
key
,
update_cfg_map
[
key
])
sys
.
argv
=
copy
.
deepcopy
(
backup_argv
)
return
cfg
def
read_images
(
self
,
paths
=
[]):
images
=
[]
for
img_path
in
paths
:
...
...
deploy/hubserving/ocr_system/module.py
浏览文件 @
5eee98f5
...
...
@@ -6,6 +6,7 @@ from __future__ import print_function
import
os
import
sys
sys
.
path
.
insert
(
0
,
"."
)
import
copy
import
time
...
...
@@ -17,6 +18,7 @@ import paddlehub as hub
from
tools.infer.utility
import
base64_to_cv2
from
tools.infer.predict_system
import
TextSystem
from
tools.infer.utility
import
parse_args
@
moduleinfo
(
...
...
@@ -31,8 +33,7 @@ class OCRSystem(hub.Module):
"""
initialize with the necessary elements
"""
from
ocr_system.params
import
read_params
cfg
=
read_params
()
cfg
=
self
.
merge_configs
()
cfg
.
use_gpu
=
use_gpu
if
use_gpu
:
...
...
@@ -51,6 +52,21 @@ class OCRSystem(hub.Module):
self
.
text_sys
=
TextSystem
(
cfg
)
def
merge_configs
(
self
,
):
# deafult cfg
backup_argv
=
copy
.
deepcopy
(
sys
.
argv
)
sys
.
argv
=
sys
.
argv
[:
1
]
cfg
=
parse_args
()
from
ocr_det.params
import
read_params
update_cfg_map
=
vars
(
read_params
())
for
key
in
update_cfg_map
:
cfg
.
__setattr__
(
key
,
update_cfg_map
[
key
])
sys
.
argv
=
copy
.
deepcopy
(
backup_argv
)
return
cfg
def
read_images
(
self
,
paths
=
[]):
images
=
[]
for
img_path
in
paths
:
...
...
deploy/hubserving/ocr_system/params.py
浏览文件 @
5eee98f5
...
...
@@ -22,6 +22,7 @@ def read_params():
cfg
.
det_db_box_thresh
=
0.5
cfg
.
det_db_unclip_ratio
=
1.6
cfg
.
use_dilation
=
False
cfg
.
det_db_score_mode
=
"fast"
#EAST parmas
cfg
.
det_east_score_thresh
=
0.8
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录