Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
ab0b4e74
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看板
提交
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):
...
@@ -219,21 +219,18 @@ class VLRecResizeImg(object):
def
__call__
(
self
,
data
):
def
__call__
(
self
,
data
):
img
=
data
[
'image'
]
img
=
data
[
'image'
]
if
self
.
infer_mode
and
self
.
character_dict_path
is
not
None
:
norm_img
,
valid_ratio
=
resize_norm_img_chinese
(
img
,
imgC
,
imgH
,
imgW
=
self
.
image_shape
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
:
else
:
imgC
,
imgH
,
imgW
=
self
.
image_shape
norm_img
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
resized_image
=
cv2
.
resize
(
valid_ratio
=
min
(
1.0
,
float
(
resized_w
/
imgW
))
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
))
data
[
'image'
]
=
norm_img
data
[
'image'
]
=
norm_img
data
[
'valid_ratio'
]
=
valid_ratio
data
[
'valid_ratio'
]
=
valid_ratio
...
...
tools/infer/predict_rec.py
浏览文件 @
ab0b4e74
...
@@ -166,6 +166,7 @@ class TextRecognizer(object):
...
@@ -166,6 +166,7 @@ class TextRecognizer(object):
def
resize_norm_img_vl
(
self
,
img
,
image_shape
):
def
resize_norm_img_vl
(
self
,
img
,
image_shape
):
imgC
,
imgH
,
imgW
=
image_shape
imgC
,
imgH
,
imgW
=
image_shape
img
=
img
[:,
:,
::
-
1
]
# bgr2rgb
resized_image
=
cv2
.
resize
(
resized_image
=
cv2
.
resize
(
img
,
(
imgW
,
imgH
),
interpolation
=
cv2
.
INTER_LINEAR
)
img
,
(
imgW
,
imgH
),
interpolation
=
cv2
.
INTER_LINEAR
)
resized_image
=
resized_image
.
astype
(
'float32'
)
resized_image
=
resized_image
.
astype
(
'float32'
)
...
...
tools/infer_rec.py
浏览文件 @
ab0b4e74
...
@@ -131,7 +131,6 @@ def main():
...
@@ -131,7 +131,6 @@ def main():
if
config
[
'Architecture'
][
'algorithm'
]
==
"SAR"
:
if
config
[
'Architecture'
][
'algorithm'
]
==
"SAR"
:
valid_ratio
=
np
.
expand_dims
(
batch
[
-
1
],
axis
=
0
)
valid_ratio
=
np
.
expand_dims
(
batch
[
-
1
],
axis
=
0
)
img_metas
=
[
paddle
.
to_tensor
(
valid_ratio
)]
img_metas
=
[
paddle
.
to_tensor
(
valid_ratio
)]
images
=
np
.
expand_dims
(
batch
[
0
],
axis
=
0
)
images
=
np
.
expand_dims
(
batch
[
0
],
axis
=
0
)
images
=
paddle
.
to_tensor
(
images
)
images
=
paddle
.
to_tensor
(
images
)
if
config
[
'Architecture'
][
'algorithm'
]
==
"SRN"
:
if
config
[
'Architecture'
][
'algorithm'
]
==
"SRN"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录