Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
ab0b4e74
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ab0b4e74
编写于
8月 02, 2022
作者:
A
andyjpaddle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix vl infer
上级
7a706ada
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
15 deletion
+12
-15
ppocr/data/imaug/rec_img_aug.py
ppocr/data/imaug/rec_img_aug.py
+11
-14
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+1
-0
tools/infer_rec.py
tools/infer_rec.py
+0
-1
未找到文件。
ppocr/data/imaug/rec_img_aug.py
浏览文件 @
ab0b4e74
...
...
@@ -219,21 +219,18 @@ class VLRecResizeImg(object):
def
__call__
(
self
,
data
):
img
=
data
[
'image'
]
if
self
.
infer_mode
and
self
.
character_dict_path
is
not
None
:
norm_img
,
valid_ratio
=
resize_norm_img_chinese
(
img
,
self
.
image_shape
)
imgC
,
imgH
,
imgW
=
self
.
image_shape
resized_image
=
cv2
.
resize
(
img
,
(
imgW
,
imgH
),
interpolation
=
cv2
.
INTER_LINEAR
)
resized_w
=
imgW
resized_image
=
resized_image
.
astype
(
'float32'
)
if
self
.
image_shape
[
0
]
==
1
:
resized_image
=
resized_image
/
255
norm_img
=
resized_image
[
np
.
newaxis
,
:]
else
:
imgC
,
imgH
,
imgW
=
self
.
image_shape
resized_image
=
cv2
.
resize
(
img
,
(
imgW
,
imgH
),
interpolation
=
cv2
.
INTER_LINEAR
)
resized_w
=
imgW
resized_image
=
resized_image
.
astype
(
'float32'
)
if
self
.
image_shape
[
0
]
==
1
:
resized_image
=
resized_image
/
255
norm_img
=
resized_image
[
np
.
newaxis
,
:]
else
:
norm_img
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
valid_ratio
=
min
(
1.0
,
float
(
resized_w
/
imgW
))
norm_img
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
valid_ratio
=
min
(
1.0
,
float
(
resized_w
/
imgW
))
data
[
'image'
]
=
norm_img
data
[
'valid_ratio'
]
=
valid_ratio
...
...
tools/infer/predict_rec.py
浏览文件 @
ab0b4e74
...
...
@@ -166,6 +166,7 @@ class TextRecognizer(object):
def
resize_norm_img_vl
(
self
,
img
,
image_shape
):
imgC
,
imgH
,
imgW
=
image_shape
img
=
img
[:,
:,
::
-
1
]
# bgr2rgb
resized_image
=
cv2
.
resize
(
img
,
(
imgW
,
imgH
),
interpolation
=
cv2
.
INTER_LINEAR
)
resized_image
=
resized_image
.
astype
(
'float32'
)
...
...
tools/infer_rec.py
浏览文件 @
ab0b4e74
...
...
@@ -131,7 +131,6 @@ def main():
if
config
[
'Architecture'
][
'algorithm'
]
==
"SAR"
:
valid_ratio
=
np
.
expand_dims
(
batch
[
-
1
],
axis
=
0
)
img_metas
=
[
paddle
.
to_tensor
(
valid_ratio
)]
images
=
np
.
expand_dims
(
batch
[
0
],
axis
=
0
)
images
=
paddle
.
to_tensor
(
images
)
if
config
[
'Architecture'
][
'algorithm'
]
==
"SRN"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录