Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
c731d54e
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看板
未验证
提交
c731d54e
编写于
8月 19, 2022
作者:
X
xiaoting
提交者:
GitHub
8月 19, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix sr typo (#7262)
* fix sr typo * rm eval visual
上级
d26da4b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
26 deletion
+7
-26
tools/infer_sr.py
tools/infer_sr.py
+5
-5
tools/program.py
tools/program.py
+2
-21
未找到文件。
tools/infer_sr.py
浏览文件 @
c731d54e
...
...
@@ -63,14 +63,14 @@ def main():
elif
op_name
in
[
'SRResize'
]:
op
[
op_name
][
'infer_mode'
]
=
True
elif
op_name
==
'KeepKeys'
:
op
[
op_name
][
'keep_keys'
]
=
[
'img
e
_lr'
]
op
[
op_name
][
'keep_keys'
]
=
[
'img_lr'
]
transforms
.
append
(
op
)
global_config
[
'infer_mode'
]
=
True
ops
=
create_operators
(
transforms
,
global_config
)
save_
res_path
=
config
[
'Global'
].
get
(
'save_res_path'
,
"./infer_result
"
)
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
save_
res
_path
)):
os
.
makedirs
(
os
.
path
.
dirname
(
save_
res
_path
))
save_
visual_path
=
config
[
'Global'
].
get
(
'save_visual'
,
"infer_result/
"
)
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
save_
visual
_path
)):
os
.
makedirs
(
os
.
path
.
dirname
(
save_
visual
_path
))
model
.
eval
()
for
file
in
get_image_file_list
(
config
[
'Global'
][
'infer_img'
]):
...
...
@@ -87,7 +87,7 @@ def main():
fm_sr
=
(
sr_img
.
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
fm_lr
=
(
lr_img
.
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
img_name_pure
=
os
.
path
.
split
(
file
)[
-
1
]
cv2
.
imwrite
(
"
infer_result/sr_{}"
.
format
(
img_name_pure
),
cv2
.
imwrite
(
"
{}/sr_{}"
.
format
(
save_visual_path
,
img_name_pure
),
fm_sr
[:,
:,
::
-
1
])
logger
.
info
(
"The visualized image saved in infer_result/sr_{}"
.
format
(
img_name_pure
))
...
...
tools/program.py
浏览文件 @
c731d54e
...
...
@@ -231,7 +231,8 @@ def train(config,
use_srn
=
config
[
'Architecture'
][
'algorithm'
]
==
"SRN"
extra_input_models
=
[
"SRN"
,
"NRTR"
,
"SAR"
,
"SEED"
,
"SVTR"
,
"SPIN"
,
"VisionLAN"
,
"RobustScanner"
"SRN"
,
"NRTR"
,
"SAR"
,
"SEED"
,
"SVTR"
,
"SPIN"
,
"VisionLAN"
,
"RobustScanner"
]
extra_input
=
False
if
config
[
'Architecture'
][
'algorithm'
]
==
'Distillation'
:
...
...
@@ -503,16 +504,6 @@ def eval(model,
preds
=
model
(
batch
)
sr_img
=
preds
[
"sr_img"
]
lr_img
=
preds
[
"lr_img"
]
for
i
in
(
range
(
sr_img
.
shape
[
0
])):
fm_sr
=
(
sr_img
[
i
].
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
fm_lr
=
(
lr_img
[
i
].
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
cv2
.
imwrite
(
"output/images/{}_{}_sr.jpg"
.
format
(
sum_images
,
i
),
fm_sr
)
cv2
.
imwrite
(
"output/images/{}_{}_lr.jpg"
.
format
(
sum_images
,
i
),
fm_lr
)
else
:
preds
=
model
(
images
)
preds
=
to_float32
(
preds
)
...
...
@@ -525,16 +516,6 @@ def eval(model,
preds
=
model
(
batch
)
sr_img
=
preds
[
"sr_img"
]
lr_img
=
preds
[
"lr_img"
]
for
i
in
(
range
(
sr_img
.
shape
[
0
])):
fm_sr
=
(
sr_img
[
i
].
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
fm_lr
=
(
lr_img
[
i
].
numpy
()
*
255
).
transpose
(
1
,
2
,
0
).
astype
(
np
.
uint8
)
cv2
.
imwrite
(
"output/images/{}_{}_sr.jpg"
.
format
(
sum_images
,
i
),
fm_sr
)
cv2
.
imwrite
(
"output/images/{}_{}_lr.jpg"
.
format
(
sum_images
,
i
),
fm_lr
)
else
:
preds
=
model
(
images
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录