Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
055f207f
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看板
未验证
提交
055f207f
编写于
12月 09, 2020
作者:
M
MissPenguin
提交者:
GitHub
12月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1371 from tink2123/update_multi
update multi dic and export
上级
91f5ab5c
7eeef593
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
101 addition
and
41 deletion
+101
-41
configs/rec/multi_language/rec_en_number_lite_train.yml
configs/rec/multi_language/rec_en_number_lite_train.yml
+2
-2
configs/rec/multi_language/rec_french_lite_train.yml
configs/rec/multi_language/rec_french_lite_train.yml
+4
-4
configs/rec/multi_language/rec_german_lite_train.yml
configs/rec/multi_language/rec_german_lite_train.yml
+2
-2
configs/rec/multi_language/rec_japan_lite_train.yml
configs/rec/multi_language/rec_japan_lite_train.yml
+2
-2
configs/rec/multi_language/rec_korean_lite_train.yml
configs/rec/multi_language/rec_korean_lite_train.yml
+2
-2
deploy/cpp_infer/src/ocr_cls.cpp
deploy/cpp_infer/src/ocr_cls.cpp
+1
-1
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+1
-1
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+2
-2
ppocr/utils/dict/en_dict.txt
ppocr/utils/dict/en_dict.txt
+63
-0
ppocr/utils/dict/french_dict.txt
ppocr/utils/dict/french_dict.txt
+2
-1
ppocr/utils/dict/german_dict.txt
ppocr/utils/dict/german_dict.txt
+2
-1
ppocr/utils/dict/japan_dict.txt
ppocr/utils/dict/japan_dict.txt
+2
-1
ppocr/utils/dict/korean_dict.txt
ppocr/utils/dict/korean_dict.txt
+3
-2
tools/export_model.py
tools/export_model.py
+11
-18
tools/infer/utility.py
tools/infer/utility.py
+2
-2
未找到文件。
configs/rec/multi_language/rec_en_number_lite_train.yml
浏览文件 @
055f207f
Global
:
Global
:
use_gpu
:
t
rue
use_gpu
:
T
rue
epoch_num
:
500
epoch_num
:
500
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
...
@@ -15,7 +15,7 @@ Global:
...
@@ -15,7 +15,7 @@ Global:
use_visualdl
:
False
use_visualdl
:
False
infer_img
:
infer_img
:
# for data or label process
# for data or label process
character_dict_path
:
ppocr/utils/dict/
ic15
_dict.txt
character_dict_path
:
ppocr/utils/dict/
en
_dict.txt
character_type
:
ch
character_type
:
ch
max_text_length
:
25
max_text_length
:
25
infer_mode
:
False
infer_mode
:
False
...
...
configs/rec/multi_language/rec_french_lite_train.yml
浏览文件 @
055f207f
Global
:
Global
:
use_gpu
:
t
rue
use_gpu
:
T
rue
epoch_num
:
500
epoch_num
:
500
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
...
@@ -19,7 +19,7 @@ Global:
...
@@ -19,7 +19,7 @@ Global:
character_type
:
french
character_type
:
french
max_text_length
:
25
max_text_length
:
25
infer_mode
:
False
infer_mode
:
False
use_space_char
:
Tru
e
use_space_char
:
Fals
e
Optimizer
:
Optimizer
:
...
...
configs/rec/multi_language/rec_german_lite_train.yml
浏览文件 @
055f207f
Global
:
Global
:
use_gpu
:
t
rue
use_gpu
:
T
rue
epoch_num
:
500
epoch_num
:
500
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
...
@@ -19,7 +19,7 @@ Global:
...
@@ -19,7 +19,7 @@ Global:
character_type
:
german
character_type
:
german
max_text_length
:
25
max_text_length
:
25
infer_mode
:
False
infer_mode
:
False
use_space_char
:
Tru
e
use_space_char
:
Fals
e
Optimizer
:
Optimizer
:
...
...
configs/rec/multi_language/rec_japan_lite_train.yml
浏览文件 @
055f207f
Global
:
Global
:
use_gpu
:
t
rue
use_gpu
:
T
rue
epoch_num
:
500
epoch_num
:
500
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
...
@@ -19,7 +19,7 @@ Global:
...
@@ -19,7 +19,7 @@ Global:
character_type
:
japan
character_type
:
japan
max_text_length
:
25
max_text_length
:
25
infer_mode
:
False
infer_mode
:
False
use_space_char
:
Tru
e
use_space_char
:
Fals
e
Optimizer
:
Optimizer
:
...
...
configs/rec/multi_language/rec_korean_lite_train.yml
浏览文件 @
055f207f
Global
:
Global
:
use_gpu
:
t
rue
use_gpu
:
T
rue
epoch_num
:
500
epoch_num
:
500
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
...
@@ -19,7 +19,7 @@ Global:
...
@@ -19,7 +19,7 @@ Global:
character_type
:
korean
character_type
:
korean
max_text_length
:
25
max_text_length
:
25
infer_mode
:
False
infer_mode
:
False
use_space_char
:
Tru
e
use_space_char
:
Fals
e
Optimizer
:
Optimizer
:
...
...
deploy/cpp_infer/src/ocr_cls.cpp
浏览文件 @
055f207f
...
@@ -81,7 +81,7 @@ cv::Mat Classifier::Run(cv::Mat &img) {
...
@@ -81,7 +81,7 @@ cv::Mat Classifier::Run(cv::Mat &img) {
void
Classifier
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
void
Classifier
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
"
/model"
,
model_dir
+
"/
params"
);
config
.
SetModel
(
model_dir
+
"
.pdmodel"
,
model_dir
+
".pdi
params"
);
if
(
this
->
use_gpu_
)
{
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
deploy/cpp_infer/src/ocr_det.cpp
浏览文件 @
055f207f
...
@@ -18,7 +18,7 @@ namespace PaddleOCR {
...
@@ -18,7 +18,7 @@ namespace PaddleOCR {
void
DBDetector
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
void
DBDetector
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
"
/model"
,
model_dir
+
"/
params"
);
config
.
SetModel
(
model_dir
+
"
.pdmodel"
,
model_dir
+
".pdi
params"
);
if
(
this
->
use_gpu_
)
{
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
055f207f
...
@@ -103,7 +103,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
...
@@ -103,7 +103,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
void
CRNNRecognizer
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
void
CRNNRecognizer
::
LoadModel
(
const
std
::
string
&
model_dir
)
{
AnalysisConfig
config
;
AnalysisConfig
config
;
config
.
SetModel
(
model_dir
+
"
/model"
,
model_dir
+
"/
params"
);
config
.
SetModel
(
model_dir
+
"
.pdmodel"
,
model_dir
+
".pdi
params"
);
if
(
this
->
use_gpu_
)
{
if
(
this
->
use_gpu_
)
{
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
config
.
EnableUseGpu
(
this
->
gpu_mem_
,
this
->
gpu_id_
);
...
...
ppocr/utils/dict/en_dict.txt
0 → 100644
浏览文件 @
055f207f
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
ppocr/utils/dict/french_dict.txt
浏览文件 @
055f207f
...
@@ -133,3 +133,4 @@ j
...
@@ -133,3 +133,4 @@ j
Å
Å
$
$
#
#
ppocr/utils/dict/german_dict.txt
浏览文件 @
055f207f
...
@@ -124,3 +124,4 @@ z
...
@@ -124,3 +124,4 @@ z
å
å
æ
æ
é
é
ppocr/utils/dict/japan_dict.txt
浏览文件 @
055f207f
...
@@ -4396,3 +4396,4 @@ z
...
@@ -4396,3 +4396,4 @@ z
z
z
~
~
・
・
ppocr/utils/dict/korean_dict.txt
浏览文件 @
055f207f
...
@@ -179,7 +179,7 @@ z
...
@@ -179,7 +179,7 @@ z
с
с
т
т
я
я
’
’
“
“
”
”
...
@@ -3685,3 +3685,4 @@ z
...
@@ -3685,3 +3685,4 @@ z
茶
茶
切
切
宅
宅
tools/export_model.py
浏览文件 @
055f207f
...
@@ -39,26 +39,12 @@ def parse_args():
...
@@ -39,26 +39,12 @@ def parse_args():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
class
Model
(
paddle
.
nn
.
Layer
):
def
__init__
(
self
,
model
):
super
(
Model
,
self
).
__init__
()
self
.
pre_model
=
model
# Please modify the 'shape' according to actual needs
@
to_static
(
input_spec
=
[
paddle
.
static
.
InputSpec
(
shape
=
[
None
,
3
,
640
,
640
],
dtype
=
'float32'
)
])
def
forward
(
self
,
inputs
):
x
=
self
.
pre_model
(
inputs
)
return
x
def
main
():
def
main
():
FLAGS
=
parse_args
()
FLAGS
=
parse_args
()
config
=
load_config
(
FLAGS
.
config
)
config
=
load_config
(
FLAGS
.
config
)
logger
=
get_logger
()
logger
=
get_logger
()
# build post process
# build post process
post_process_class
=
build_post_process
(
config
[
'PostProcess'
],
post_process_class
=
build_post_process
(
config
[
'PostProcess'
],
config
[
'Global'
])
config
[
'Global'
])
...
@@ -71,9 +57,16 @@ def main():
...
@@ -71,9 +57,16 @@ def main():
init_model
(
config
,
model
,
logger
)
init_model
(
config
,
model
,
logger
)
model
.
eval
()
model
.
eval
()
model
=
Model
(
model
)
save_path
=
'{}/{}/inference'
.
format
(
FLAGS
.
output_path
,
save_path
=
'{}/{}'
.
format
(
FLAGS
.
output_path
,
config
[
'Architecture'
][
'model_type'
])
config
[
'Architecture'
][
'model_type'
])
infer_shape
=
[
3
,
32
,
100
]
if
config
[
'Architecture'
][
'model_type'
]
!=
"det"
else
[
3
,
640
,
640
]
model
=
to_static
(
model
,
input_spec
=
[
paddle
.
static
.
InputSpec
(
shape
=
[
None
]
+
infer_shape
,
dtype
=
'float32'
)
])
paddle
.
jit
.
save
(
model
,
save_path
)
paddle
.
jit
.
save
(
model
,
save_path
)
logger
.
info
(
'inference model is saved to {}'
.
format
(
save_path
))
logger
.
info
(
'inference model is saved to {}'
.
format
(
save_path
))
...
...
tools/infer/utility.py
浏览文件 @
055f207f
...
@@ -100,8 +100,8 @@ def create_predictor(args, mode, logger):
...
@@ -100,8 +100,8 @@ def create_predictor(args, mode, logger):
if
model_dir
is
None
:
if
model_dir
is
None
:
logger
.
info
(
"not find {} model file path {}"
.
format
(
mode
,
model_dir
))
logger
.
info
(
"not find {} model file path {}"
.
format
(
mode
,
model_dir
))
sys
.
exit
(
0
)
sys
.
exit
(
0
)
model_file_path
=
model_dir
+
"
/
model"
model_file_path
=
model_dir
+
"
.pd
model"
params_file_path
=
model_dir
+
"
/
params"
params_file_path
=
model_dir
+
"
.pdi
params"
if
not
os
.
path
.
exists
(
model_file_path
):
if
not
os
.
path
.
exists
(
model_file_path
):
logger
.
info
(
"not find model file path {}"
.
format
(
model_file_path
))
logger
.
info
(
"not find model file path {}"
.
format
(
model_file_path
))
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录