Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
46e3442e
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看板
提交
46e3442e
编写于
7月 10, 2022
作者:
xuyang2233
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add spin
上级
f56a7e9c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
9 deletion
+8
-9
configs/rec/rec_r32_gaspin_bilstm_att.yml
configs/rec/rec_r32_gaspin_bilstm_att.yml
+2
-2
ppocr/data/imaug/rec_img_aug.py
ppocr/data/imaug/rec_img_aug.py
+1
-3
test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml
...s/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml
+2
-2
tools/export_model.py
tools/export_model.py
+1
-1
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+2
-1
未找到文件。
configs/rec/rec_r32_gaspin_bilstm_att.yml
浏览文件 @
46e3442e
...
@@ -75,7 +75,7 @@ Train:
...
@@ -75,7 +75,7 @@ Train:
data_dir
:
./train_data/ic15_data/
data_dir
:
./train_data/ic15_data/
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_train.txt"
]
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_train.txt"
]
transforms
:
transforms
:
-
NRTR
DecodeImage
:
# load image
-
DecodeImage
:
# load image
img_mode
:
BGR
img_mode
:
BGR
channel_first
:
False
channel_first
:
False
-
SPINAttnLabelEncode
:
# Class handling label
-
SPINAttnLabelEncode
:
# Class handling label
...
@@ -98,7 +98,7 @@ Eval:
...
@@ -98,7 +98,7 @@ Eval:
data_dir
:
./train_data/ic15_data
data_dir
:
./train_data/ic15_data
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_test.txt"
]
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_test.txt"
]
transforms
:
transforms
:
-
NRTR
DecodeImage
:
# load image
-
DecodeImage
:
# load image
img_mode
:
BGR
img_mode
:
BGR
channel_first
:
False
channel_first
:
False
-
SPINAttnLabelEncode
:
# Class handling label
-
SPINAttnLabelEncode
:
# Class handling label
...
...
ppocr/data/imaug/rec_img_aug.py
浏览文件 @
46e3442e
...
@@ -274,6 +274,7 @@ class SPINRecResizeImg(object):
...
@@ -274,6 +274,7 @@ class SPINRecResizeImg(object):
def
__call__
(
self
,
data
):
def
__call__
(
self
,
data
):
img
=
data
[
'image'
]
img
=
data
[
'image'
]
img
=
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2GRAY
)
# different interpolation type corresponding the OpenCV
# different interpolation type corresponding the OpenCV
if
self
.
interpolation
==
0
:
if
self
.
interpolation
==
0
:
interpolation
=
cv2
.
INTER_NEAREST
interpolation
=
cv2
.
INTER_NEAREST
...
@@ -294,12 +295,9 @@ class SPINRecResizeImg(object):
...
@@ -294,12 +295,9 @@ class SPINRecResizeImg(object):
img
=
np
.
expand_dims
(
img
,
-
1
)
img
=
np
.
expand_dims
(
img
,
-
1
)
img
=
img
.
transpose
((
2
,
0
,
1
))
img
=
img
.
transpose
((
2
,
0
,
1
))
# normalize the image
# normalize the image
to_rgb
=
False
img
=
img
.
copy
().
astype
(
np
.
float32
)
img
=
img
.
copy
().
astype
(
np
.
float32
)
mean
=
np
.
float64
(
self
.
mean
.
reshape
(
1
,
-
1
))
mean
=
np
.
float64
(
self
.
mean
.
reshape
(
1
,
-
1
))
stdinv
=
1
/
np
.
float64
(
self
.
std
.
reshape
(
1
,
-
1
))
stdinv
=
1
/
np
.
float64
(
self
.
std
.
reshape
(
1
,
-
1
))
if
to_rgb
:
cv2
.
cvtColor
(
img
,
cv2
.
COLOR_BGR2RGB
)
img
-=
mean
img
-=
mean
img
*=
stdinv
img
*=
stdinv
data
[
'image'
]
=
img
data
[
'image'
]
=
img
...
...
test_tipc/configs/rec_r32_gaspin_bilstm_att/rec_r32_gaspin_bilstm_att.yml
浏览文件 @
46e3442e
...
@@ -76,7 +76,7 @@ Train:
...
@@ -76,7 +76,7 @@ Train:
data_dir
:
./train_data/ic15_data/
data_dir
:
./train_data/ic15_data/
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_train.txt"
]
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_train.txt"
]
transforms
:
transforms
:
-
NRTR
DecodeImage
:
# load image
-
DecodeImage
:
# load image
img_mode
:
BGR
img_mode
:
BGR
channel_first
:
False
channel_first
:
False
-
SPINAttnLabelEncode
:
# Class handling label
-
SPINAttnLabelEncode
:
# Class handling label
...
@@ -99,7 +99,7 @@ Eval:
...
@@ -99,7 +99,7 @@ Eval:
data_dir
:
./train_data/ic15_data
data_dir
:
./train_data/ic15_data
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_test.txt"
]
label_file_list
:
[
"
./train_data/ic15_data/rec_gt_test.txt"
]
transforms
:
transforms
:
-
NRTR
DecodeImage
:
# load image
-
DecodeImage
:
# load image
img_mode
:
BGR
img_mode
:
BGR
channel_first
:
False
channel_first
:
False
-
SPINAttnLabelEncode
:
# Class handling label
-
SPINAttnLabelEncode
:
# Class handling label
...
...
tools/export_model.py
浏览文件 @
46e3442e
...
@@ -91,7 +91,7 @@ def export_single_model(model,
...
@@ -91,7 +91,7 @@ def export_single_model(model,
]
]
# print([None, 3, 32, 128])
# print([None, 3, 32, 128])
model
=
to_static
(
model
,
input_spec
=
other_shape
)
model
=
to_static
(
model
,
input_spec
=
other_shape
)
elif
arch_config
[
"algorithm"
]
==
"NRTR"
:
elif
arch_config
[
"algorithm"
]
==
"NRTR"
or
arch_config
[
"algorithm"
]
==
"SPIN"
:
other_shape
=
[
other_shape
=
[
paddle
.
static
.
InputSpec
(
paddle
.
static
.
InputSpec
(
shape
=
[
None
,
1
,
32
,
100
],
dtype
=
"float32"
),
shape
=
[
None
,
1
,
32
,
100
],
dtype
=
"float32"
),
...
...
tools/infer/predict_rec.py
浏览文件 @
46e3442e
...
@@ -81,7 +81,6 @@ class TextRecognizer(object):
...
@@ -81,7 +81,6 @@ class TextRecognizer(object):
"character_dict_path"
:
args
.
rec_char_dict_path
,
"character_dict_path"
:
args
.
rec_char_dict_path
,
"use_space_char"
:
args
.
use_space_char
"use_space_char"
:
args
.
use_space_char
}
}
elif
self
.
rec_algorithm
==
"SPIN"
:
elif
self
.
rec_algorithm
==
"SPIN"
:
postprocess_params
=
{
postprocess_params
=
{
'name'
:
'SPINAttnLabelDecode'
,
'name'
:
'SPINAttnLabelDecode'
,
...
@@ -362,6 +361,8 @@ class TextRecognizer(object):
...
@@ -362,6 +361,8 @@ class TextRecognizer(object):
norm_img_batch
.
append
(
norm_img
)
norm_img_batch
.
append
(
norm_img
)
elif
self
.
rec_algorithm
==
'SPIN'
:
elif
self
.
rec_algorithm
==
'SPIN'
:
norm_img
=
self
.
resize_norm_img_spin
(
img_list
[
indices
[
ino
]])
norm_img
=
self
.
resize_norm_img_spin
(
img_list
[
indices
[
ino
]])
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img_batch
.
append
(
norm_img
)
elif
self
.
rec_algorithm
==
"ABINet"
:
elif
self
.
rec_algorithm
==
"ABINet"
:
norm_img
=
self
.
resize_norm_img_abinet
(
norm_img
=
self
.
resize_norm_img_abinet
(
img_list
[
indices
[
ino
]],
self
.
rec_image_shape
)
img_list
[
indices
[
ino
]],
self
.
rec_image_shape
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录