Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
4cb82453
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看板
提交
4cb82453
编写于
8月 17, 2021
作者:
T
Topdu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add rec_nrtr
上级
8762a64f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
6 addition
and
122 deletion
+6
-122
configs/rec/rec_mtb_nrtr.yml
configs/rec/rec_mtb_nrtr.yml
+1
-17
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+1
-1
ppocr/metrics/rec_metric.py
ppocr/metrics/rec_metric.py
+2
-2
ppocr/modeling/architectures/base_model.py
ppocr/modeling/architectures/base_model.py
+0
-1
ppocr/modeling/backbones/__init__.py
ppocr/modeling/backbones/__init__.py
+1
-1
ppocr/modeling/heads/rec_nrtr_optim_head.py
ppocr/modeling/heads/rec_nrtr_optim_head.py
+0
-4
ppocr/postprocess/rec_postprocess.py
ppocr/postprocess/rec_postprocess.py
+1
-1
ppocr/utils/dict_99.txt
ppocr/utils/dict_99.txt
+0
-95
未找到文件。
configs/rec/rec_mtb_nrtr.yml
浏览文件 @
4cb82453
...
...
@@ -3,38 +3,22 @@ Global:
epoch_num
:
21
log_smooth_window
:
20
print_batch_step
:
10
<<<<<<< HEAD
save_model_dir
:
./output/rec/nrtr_final/
save_model_dir
:
./output/rec/nrtr/
save_epoch_step
:
1
# evaluation is run every 2000 iterations
eval_batch_step
:
[
0
,
2000
]
cal_metric_during_train
:
True
=======
save_model_dir
:
./output/rec/piloptimnrtr/
save_epoch_step
:
1
# evaluation is run every 2000 iterations
eval_batch_step
:
[
0
,
2000
]
cal_metric_during_train
:
False
>
>>>>>>
9c67a7f...
add
rec_nrtr
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/imgs_words_en/word_10.png
# for data or label process
<<<<<<< HEAD
character_dict_path
:
character_type
:
EN_symbol
max_text_length
:
25
infer_mode
:
False
use_space_char
:
True
=======
character_dict_path
:
ppocr/utils/dict_99.txt
character_type
:
dict_99
max_text_length
:
25
infer_mode
:
False
use_space_char
:
False
>
>>>>>>
9c67a7f...
add
rec_nrtr
save_res_path
:
./output/rec/predicts_nrtr.txt
Optimizer
:
...
...
ppocr/data/imaug/label_ops.py
浏览文件 @
4cb82453
...
...
@@ -96,7 +96,7 @@ class BaseRecLabelEncode(object):
'ch'
,
'en'
,
'EN_symbol'
,
'french'
,
'german'
,
'japan'
,
'korean'
,
'EN'
,
'it'
,
'xi'
,
'pu'
,
'ru'
,
'ar'
,
'ta'
,
'ug'
,
'fa'
,
'ur'
,
'rs'
,
'oc'
,
'rsc'
,
'bg'
,
'uk'
,
'be'
,
'te'
,
'ka'
,
'chinese_cht'
,
'hi'
,
'mr'
,
'ne'
,
'latin'
,
'arabic'
,
'cyrillic'
,
'devanagari'
,
'dict_99'
'mr'
,
'ne'
,
'latin'
,
'arabic'
,
'cyrillic'
,
'devanagari'
]
assert
character_type
in
support_character_type
,
"Only {} are supported now but get {}"
.
format
(
support_character_type
,
character_type
)
...
...
ppocr/metrics/rec_metric.py
浏览文件 @
4cb82453
...
...
@@ -30,7 +30,7 @@ class RecMetric(object):
target
=
target
.
replace
(
" "
,
""
)
norm_edit_dis
+=
Levenshtein
.
distance
(
pred
,
target
)
/
max
(
len
(
pred
),
len
(
target
),
1
)
if
pred
.
lower
()
==
target
.
lower
()
:
if
pred
==
target
:
correct_num
+=
1
all_num
+=
1
self
.
correct_num
+=
correct_num
...
...
@@ -57,4 +57,4 @@ class RecMetric(object):
self
.
correct_num
=
0
self
.
all_num
=
0
self
.
norm_edit_dis
=
0
\ No newline at end of file
ppocr/modeling/architectures/base_model.py
浏览文件 @
4cb82453
...
...
@@ -14,7 +14,6 @@
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
paddle
from
paddle
import
nn
from
ppocr.modeling.transforms
import
build_transform
from
ppocr.modeling.backbones
import
build_backbone
...
...
ppocr/modeling/backbones/__init__.py
浏览文件 @
4cb82453
...
...
@@ -27,7 +27,7 @@ def build_backbone(config, model_type):
from
.rec_resnet_fpn
import
ResNetFPN
from
.rec_nrtr_mtb
import
MTB
from
.rec_swin
import
SwinTransformer
support_dict
=
[
'MobileNetV3'
,
'ResNet'
,
'ResNetFPN'
,
'MTB'
,
'SwinTransformer'
]
support_dict
=
[
'MobileNetV3'
,
'ResNet'
,
'ResNetFPN'
,
'MTB'
,
'SwinTransformer'
]
elif
model_type
==
'e2e'
:
from
.e2e_resnet_vd_pg
import
ResNet
...
...
ppocr/modeling/heads/rec_nrtr_optim_head.py
浏览文件 @
4cb82453
...
...
@@ -7,11 +7,7 @@ from paddle.nn import LayerList
from
paddle.nn.initializer
import
XavierNormal
as
xavier_uniform_
from
paddle.nn
import
Dropout
,
Linear
,
LayerNorm
,
Conv2D
import
numpy
as
np
<<<<<<<
HEAD
from
ppocr.modeling.heads.multiheadAttention
import
MultiheadAttentionOptim
=======
from
ppocr.modeling.backbones.multiheadAttention
import
MultiheadAttentionOptim
>>>>>>>
9
c67a7f
...
add
rec_nrtr
from
paddle.nn.initializer
import
Constant
as
constant_
from
paddle.nn.initializer
import
XavierNormal
as
xavier_normal_
...
...
ppocr/postprocess/rec_postprocess.py
浏览文件 @
4cb82453
...
...
@@ -28,7 +28,7 @@ class BaseRecLabelDecode(object):
'ch'
,
'en'
,
'EN_symbol'
,
'french'
,
'german'
,
'japan'
,
'korean'
,
'it'
,
'xi'
,
'pu'
,
'ru'
,
'ar'
,
'ta'
,
'ug'
,
'fa'
,
'ur'
,
'rs'
,
'oc'
,
'rsc'
,
'bg'
,
'uk'
,
'be'
,
'te'
,
'ka'
,
'chinese_cht'
,
'hi'
,
'mr'
,
'ne'
,
'EN'
,
'latin'
,
'arabic'
,
'cyrillic'
,
'devanagari'
,
'dict_99'
'ne'
,
'EN'
,
'latin'
,
'arabic'
,
'cyrillic'
,
'devanagari'
]
assert
character_type
in
support_character_type
,
"Only {} are supported now but get {}"
.
format
(
support_character_type
,
character_type
)
...
...
ppocr/utils/dict_99.txt
已删除
100644 → 0
浏览文件 @
8762a64f
!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录