Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
93c919e6
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看板
未验证
提交
93c919e6
编写于
3月 15, 2021
作者:
D
Double_V
提交者:
GitHub
3月 15, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dygraph' into pgnet-v1
上级
97111112
f687e092
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
9 addition
and
5 deletion
+9
-5
ppocr/data/imaug/randaugment.py
ppocr/data/imaug/randaugment.py
+4
-1
tools/infer/predict_cls.py
tools/infer/predict_cls.py
+1
-1
tools/infer/predict_det.py
tools/infer/predict_det.py
+1
-1
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+1
-1
tools/infer/utility.py
tools/infer/utility.py
+2
-1
未找到文件。
ppocr/data/imaug/randaugment.py
浏览文件 @
93c919e6
...
@@ -117,13 +117,16 @@ class RawRandAugment(object):
...
@@ -117,13 +117,16 @@ class RawRandAugment(object):
class
RandAugment
(
RawRandAugment
):
class
RandAugment
(
RawRandAugment
):
""" RandAugment wrapper to auto fit different img types """
""" RandAugment wrapper to auto fit different img types """
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
prob
=
0.5
,
*
args
,
**
kwargs
):
self
.
prob
=
prob
if
six
.
PY2
:
if
six
.
PY2
:
super
(
RandAugment
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
RandAugment
,
self
).
__init__
(
*
args
,
**
kwargs
)
else
:
else
:
super
().
__init__
(
*
args
,
**
kwargs
)
super
().
__init__
(
*
args
,
**
kwargs
)
def
__call__
(
self
,
data
):
def
__call__
(
self
,
data
):
if
np
.
random
.
rand
()
>
self
.
prob
:
return
data
img
=
data
[
'image'
]
img
=
data
[
'image'
]
if
not
isinstance
(
img
,
Image
.
Image
):
if
not
isinstance
(
img
,
Image
.
Image
):
img
=
np
.
ascontiguousarray
(
img
)
img
=
np
.
ascontiguousarray
(
img
)
...
...
tools/infer/predict_cls.py
浏览文件 @
93c919e6
...
@@ -98,10 +98,10 @@ class TextClassifier(object):
...
@@ -98,10 +98,10 @@ class TextClassifier(object):
norm_img_batch
=
np
.
concatenate
(
norm_img_batch
)
norm_img_batch
=
np
.
concatenate
(
norm_img_batch
)
norm_img_batch
=
norm_img_batch
.
copy
()
norm_img_batch
=
norm_img_batch
.
copy
()
starttime
=
time
.
time
()
starttime
=
time
.
time
()
self
.
input_tensor
.
copy_from_cpu
(
norm_img_batch
)
self
.
input_tensor
.
copy_from_cpu
(
norm_img_batch
)
self
.
predictor
.
run
()
self
.
predictor
.
run
()
prob_out
=
self
.
output_tensors
[
0
].
copy_to_cpu
()
prob_out
=
self
.
output_tensors
[
0
].
copy_to_cpu
()
self
.
predictor
.
try_shrink_memory
()
cls_result
=
self
.
postprocess_op
(
prob_out
)
cls_result
=
self
.
postprocess_op
(
prob_out
)
elapse
+=
time
.
time
()
-
starttime
elapse
+=
time
.
time
()
-
starttime
for
rno
in
range
(
len
(
cls_result
)):
for
rno
in
range
(
len
(
cls_result
)):
...
...
tools/infer/predict_det.py
浏览文件 @
93c919e6
...
@@ -180,7 +180,7 @@ class TextDetector(object):
...
@@ -180,7 +180,7 @@ class TextDetector(object):
preds
[
'maps'
]
=
outputs
[
0
]
preds
[
'maps'
]
=
outputs
[
0
]
else
:
else
:
raise
NotImplementedError
raise
NotImplementedError
self
.
predictor
.
try_shrink_memory
()
post_result
=
self
.
postprocess_op
(
preds
,
shape_list
)
post_result
=
self
.
postprocess_op
(
preds
,
shape_list
)
dt_boxes
=
post_result
[
0
][
'points'
]
dt_boxes
=
post_result
[
0
][
'points'
]
if
self
.
det_algorithm
==
"SAST"
and
self
.
det_sast_polygon
:
if
self
.
det_algorithm
==
"SAST"
and
self
.
det_sast_polygon
:
...
...
tools/infer/predict_rec.py
浏览文件 @
93c919e6
...
@@ -237,7 +237,7 @@ class TextRecognizer(object):
...
@@ -237,7 +237,7 @@ class TextRecognizer(object):
output
=
output_tensor
.
copy_to_cpu
()
output
=
output_tensor
.
copy_to_cpu
()
outputs
.
append
(
output
)
outputs
.
append
(
output
)
preds
=
outputs
[
0
]
preds
=
outputs
[
0
]
self
.
predictor
.
try_shrink_memory
()
rec_result
=
self
.
postprocess_op
(
preds
)
rec_result
=
self
.
postprocess_op
(
preds
)
for
rno
in
range
(
len
(
rec_result
)):
for
rno
in
range
(
len
(
rec_result
)):
rec_res
[
indices
[
beg_img_no
+
rno
]]
=
rec_result
[
rno
]
rec_res
[
indices
[
beg_img_no
+
rno
]]
=
rec_result
[
rno
]
...
...
tools/infer/utility.py
浏览文件 @
93c919e6
...
@@ -145,7 +145,8 @@ def create_predictor(args, mode, logger):
...
@@ -145,7 +145,8 @@ def create_predictor(args, mode, logger):
#config.set_mkldnn_op({'conv2d', 'depthwise_conv2d', 'pool2d', 'batch_norm'})
#config.set_mkldnn_op({'conv2d', 'depthwise_conv2d', 'pool2d', 'batch_norm'})
args
.
rec_batch_num
=
1
args
.
rec_batch_num
=
1
# config.enable_memory_optim()
# enable memory optim
config
.
enable_memory_optim
()
config
.
disable_glog_info
()
config
.
disable_glog_info
()
config
.
delete_pass
(
"conv_transpose_eltwiseadd_bn_fuse_pass"
)
config
.
delete_pass
(
"conv_transpose_eltwiseadd_bn_fuse_pass"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录