Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
d24a39df
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看板
提交
d24a39df
编写于
5月 12, 2020
作者:
T
tink2123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use public function for inference
上级
4eb359e8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
36 addition
and
161 deletion
+36
-161
configs/rec/rec_chinese_lite_train.yml
configs/rec/rec_chinese_lite_train.yml
+0
-42
configs/rec/rec_chinese_reader.yml
configs/rec/rec_chinese_reader.yml
+0
-13
configs/rec/rec_icdar15_reader.yml
configs/rec/rec_icdar15_reader.yml
+1
-0
configs/rec/rec_icdar15_train.yml
configs/rec/rec_icdar15_train.yml
+4
-5
ppocr/data/rec/dataset_traversal.py
ppocr/data/rec/dataset_traversal.py
+2
-9
ppocr/utils/ic15_dict.txt
ppocr/utils/ic15_dict.txt
+26
-76
set_env.sh
set_env.sh
+0
-10
tools/infer_rec.py
tools/infer_rec.py
+3
-6
未找到文件。
configs/rec/rec_chinese_lite_train.yml
已删除
100755 → 0
浏览文件 @
4eb359e8
Global
:
algorithm
:
CRNN
use_gpu
:
true
epoch_num
:
300
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
output
save_epoch_step
:
3
eval_batch_step
:
2000
train_batch_size_per_card
:
256
test_batch_size_per_card
:
256
image_shape
:
[
3
,
32
,
100
]
max_text_length
:
25
character_type
:
ch
character_dict_path
:
./ppocr/utils/ppocr_keys_v1.txt
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_chinese_reader.yml
pretrain_weights
:
infer_img
:
./infer_img
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
Backbone
:
function
:
ppocr.modeling.backbones.rec_mobilenet_v3,MobileNetV3
scale
:
0.5
model_name
:
small
Head
:
function
:
ppocr.modeling.heads.rec_ctc_head,CTCPredict
encoder_type
:
rnn
SeqRNN
:
hidden_size
:
48
Loss
:
function
:
ppocr.modeling.losses.rec_ctc_loss,CTCLoss
Optimizer
:
function
:
ppocr.optimizer,AdamDecay
base_lr
:
0.001
beta1
:
0.9
beta2
:
0.999
configs/rec/rec_chinese_reader.yml
已删除
100755 → 0
浏览文件 @
4eb359e8
TrainReader
:
reader_function
:
ppocr.data.rec.dataset_traversal,SimpleReader
num_workers
:
8
img_set_dir
:
./train_data
label_file_path
:
./train_data/train_label.txt
EvalReader
:
reader_function
:
ppocr.data.rec.dataset_traversal,SimpleReader
img_set_dir
:
./train_data
label_file_path
:
./train_data/test_label.txt
TestReader
:
reader_function
:
ppocr.data.rec.dataset_traversal,SimpleReader
configs/rec/rec_ic15_reader.yml
→
configs/rec/rec_ic
dar
15_reader.yml
浏览文件 @
d24a39df
...
@@ -11,3 +11,4 @@ EvalReader:
...
@@ -11,3 +11,4 @@ EvalReader:
TestReader
:
TestReader
:
reader_function
:
ppocr.data.rec.dataset_traversal,SimpleReader
reader_function
:
ppocr.data.rec.dataset_traversal,SimpleReader
infer_img
:
./infer_img
configs/rec/rec_ic15_train.yml
→
configs/rec/rec_ic
dar
15_train.yml
浏览文件 @
d24a39df
...
@@ -5,8 +5,8 @@ Global:
...
@@ -5,8 +5,8 @@ Global:
log_smooth_window
:
20
log_smooth_window
:
20
print_batch_step
:
10
print_batch_step
:
10
save_model_dir
:
output_ic15
save_model_dir
:
output_ic15
save_epoch_step
:
3
save_epoch_step
:
3
00
eval_batch_step
:
200
0
eval_batch_step
:
200
train_batch_size_per_card
:
256
train_batch_size_per_card
:
256
test_batch_size_per_card
:
256
test_batch_size_per_card
:
256
image_shape
:
[
3
,
32
,
100
]
image_shape
:
[
3
,
32
,
100
]
...
@@ -14,9 +14,8 @@ Global:
...
@@ -14,9 +14,8 @@ Global:
character_type
:
ch
character_type
:
ch
character_dict_path
:
./ppocr/utils/ic15_dict.txt
character_dict_path
:
./ppocr/utils/ic15_dict.txt
loss_type
:
ctc
loss_type
:
ctc
reader_yml
:
./configs/rec/rec_ic15_reader.yml
reader_yml
:
./configs/rec/rec_icdar15_reader.yml
pretrain_weights
:
./pretrain_models/best_accuracy
pretrain_weights
:
./pretrain_models/CRNN/best_accuracy
infer_img
:
./infer_img
Architecture
:
Architecture
:
function
:
ppocr.modeling.architectures.rec_model,RecModel
function
:
ppocr.modeling.architectures.rec_model,RecModel
...
...
ppocr/data/rec/dataset_traversal.py
浏览文件 @
d24a39df
...
@@ -22,6 +22,7 @@ import string
...
@@ -22,6 +22,7 @@ import string
import
lmdb
import
lmdb
from
ppocr.utils.utility
import
initial_logger
from
ppocr.utils.utility
import
initial_logger
from
tools.infer.utility
import
get_image_file_list
logger
=
initial_logger
()
logger
=
initial_logger
()
from
.img_tools
import
process_image
,
get_img_data
from
.img_tools
import
process_image
,
get_img_data
...
@@ -165,15 +166,7 @@ class SimpleReader(object):
...
@@ -165,15 +166,7 @@ class SimpleReader(object):
def
sample_iter_reader
():
def
sample_iter_reader
():
if
self
.
mode
==
'test'
:
if
self
.
mode
==
'test'
:
image_file_list
=
[]
image_file_list
=
get_image_file_list
(
self
.
infer_img
)
if
os
.
path
.
isfile
(
self
.
infer_img
):
image_file_list
=
[
self
.
infer_img
]
elif
os
.
path
.
isdir
(
self
.
infer_img
):
for
single_file
in
os
.
listdir
(
self
.
infer_img
):
if
single_file
.
split
(
'.'
)[
-
1
]
not
in
[
'bmp'
,
'jpg'
,
'jpeg'
,
'png'
,
'JPEG'
,
'JPG'
,
'PNG'
]:
continue
image_file_list
.
append
(
os
.
path
.
join
(
self
.
infer_img
,
single_file
))
for
single_img
in
image_file_list
:
for
single_img
in
image_file_list
:
img
=
cv2
.
imread
(
single_img
)
img
=
cv2
.
imread
(
single_img
)
if
img
.
shape
[
-
1
]
==
1
or
len
(
list
(
img
.
shape
))
==
2
:
if
img
.
shape
[
-
1
]
==
1
or
len
(
list
(
img
.
shape
))
==
2
:
...
...
ppocr/utils/ic15_dict.txt
浏览文件 @
d24a39df
J
a
O
b
I
c
N
d
T
y
o
u
r
s
e
e
l
f
f
1
5
4
9
7
2
8
0
F
m
P
A
B
L
C
K
S
R
E
Y
U
p
d
g
g
a
h
t
i
i
j
k
l
m
n
n
h
o
W
p
D
q
r
s
t
u
v
v
H
V
G
w
w
M
!
k
c
.
(
)
X
b
-
Q
x
x
Z
y
?
@
3
/
%
$
,
'
:
z
z
&
0
j
1
2
3
4
5
6
6
+
7
8
[
9
]
;
#
q
\
´
É
=
set_env.sh
已删除
100644 → 0
浏览文件 @
4eb359e8
#. /paddle/set_env.sh↩
export
CUDA_VISIBLE_DEVICES
=
"0,1,2,3"
export
FLAGS_fraction_of_gpu_memory_to_use
=
1.0
python_bin_dir
=
"/opt/_internal/cpython-3.7.0/bin/"
alias
python
=
$python_bin_dir
"python3.7"
alias
pip
=
$python_bin_dir
"pip3.7"
alias
ipython
=
$python_bin_dir
"ipython3"
export
LD_LIBRARY_PATH
=
/opt/_internal/cpython-3.7.0/lib:
$LD_LIBRARY_PATH
export
PYTHONPATH
=
$PYTHONPATH
:.
ldconfig
tools/infer_rec.py
浏览文件 @
d24a39df
...
@@ -46,7 +46,7 @@ from ppocr.data.reader_main import reader_main
...
@@ -46,7 +46,7 @@ from ppocr.data.reader_main import reader_main
from
ppocr.utils.save_load
import
init_model
from
ppocr.utils.save_load
import
init_model
from
ppocr.utils.character
import
CharacterOps
from
ppocr.utils.character
import
CharacterOps
from
ppocr.utils.utility
import
create_module
from
ppocr.utils.utility
import
create_module
from
tools.infer.utility
import
get_image_file_list
logger
=
initial_logger
()
logger
=
initial_logger
()
...
@@ -79,11 +79,8 @@ def main():
...
@@ -79,11 +79,8 @@ def main():
init_model
(
config
,
eval_prog
,
exe
)
init_model
(
config
,
eval_prog
,
exe
)
blobs
=
reader_main
(
config
,
'test'
)()
blobs
=
reader_main
(
config
,
'test'
)()
infer_img
=
config
[
'Global'
][
'infer_img'
]
infer_img
=
config
[
'TestReader'
][
'infer_img'
]
if
os
.
path
.
isfile
(
infer_img
):
infer_list
=
get_image_file_list
(
infer_img
)
infer_list
=
[
infer_img
]
elif
os
.
path
.
isdir
(
infer_img
):
infer_list
=
os
.
listdir
(
config
[
'Global'
][
'infer_img'
])
max_img_num
=
len
(
infer_list
)
max_img_num
=
len
(
infer_list
)
if
len
(
infer_list
)
==
0
:
if
len
(
infer_list
)
==
0
:
logger
.
info
(
"Can not find img in infer_img dir."
)
logger
.
info
(
"Can not find img in infer_img dir."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录