Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
2bd63236
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看板
提交
2bd63236
编写于
5月 20, 2020
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify batch num in rec and fix sorted_box func
上级
0bf34a25
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
2 deletion
+5
-2
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+2
-1
tools/infer/utility.py
tools/infer/utility.py
+3
-1
未找到文件。
tools/infer/predict_rec.py
浏览文件 @
2bd63236
...
@@ -31,6 +31,7 @@ class TextRecognizer(object):
...
@@ -31,6 +31,7 @@ class TextRecognizer(object):
image_shape
=
[
int
(
v
)
for
v
in
args
.
rec_image_shape
.
split
(
","
)]
image_shape
=
[
int
(
v
)
for
v
in
args
.
rec_image_shape
.
split
(
","
)]
self
.
rec_image_shape
=
image_shape
self
.
rec_image_shape
=
image_shape
self
.
character_type
=
args
.
rec_char_type
self
.
character_type
=
args
.
rec_char_type
self
.
rec_batch_num
=
args
.
rec_batch_num
char_ops_params
=
{}
char_ops_params
=
{}
char_ops_params
[
"character_type"
]
=
args
.
rec_char_type
char_ops_params
[
"character_type"
]
=
args
.
rec_char_type
char_ops_params
[
"character_dict_path"
]
=
args
.
rec_char_dict_path
char_ops_params
[
"character_dict_path"
]
=
args
.
rec_char_dict_path
...
@@ -59,8 +60,8 @@ class TextRecognizer(object):
...
@@ -59,8 +60,8 @@ class TextRecognizer(object):
def
__call__
(
self
,
img_list
):
def
__call__
(
self
,
img_list
):
img_num
=
len
(
img_list
)
img_num
=
len
(
img_list
)
batch_num
=
12
rec_res
=
[]
rec_res
=
[]
batch_num
=
self
.
rec_batch_num
predict_time
=
0
predict_time
=
0
for
beg_img_no
in
range
(
0
,
img_num
,
batch_num
):
for
beg_img_no
in
range
(
0
,
img_num
,
batch_num
):
end_img_no
=
min
(
img_num
,
beg_img_no
+
batch_num
)
end_img_no
=
min
(
img_num
,
beg_img_no
+
batch_num
)
...
...
tools/infer/utility.py
浏览文件 @
2bd63236
...
@@ -56,6 +56,7 @@ def parse_args():
...
@@ -56,6 +56,7 @@ def parse_args():
parser
.
add_argument
(
"--rec_model_dir"
,
type
=
str
)
parser
.
add_argument
(
"--rec_model_dir"
,
type
=
str
)
parser
.
add_argument
(
"--rec_image_shape"
,
type
=
str
,
default
=
"3, 32, 320"
)
parser
.
add_argument
(
"--rec_image_shape"
,
type
=
str
,
default
=
"3, 32, 320"
)
parser
.
add_argument
(
"--rec_char_type"
,
type
=
str
,
default
=
'ch'
)
parser
.
add_argument
(
"--rec_char_type"
,
type
=
str
,
default
=
'ch'
)
parser
.
add_argument
(
"--rec_batch_num"
,
type
=
int
,
default
=
30
)
parser
.
add_argument
(
parser
.
add_argument
(
"--rec_char_dict_path"
,
"--rec_char_dict_path"
,
type
=
str
,
type
=
str
,
...
@@ -172,7 +173,8 @@ def draw_ocr(image, boxes, txts, scores, draw_txt=True, drop_score=0.5):
...
@@ -172,7 +173,8 @@ def draw_ocr(image, boxes, txts, scores, draw_txt=True, drop_score=0.5):
continue
continue
font
=
ImageFont
.
truetype
(
font
=
ImageFont
.
truetype
(
"./doc/simfang.ttf"
,
font_size
,
encoding
=
"utf-8"
)
"./doc/simfang.ttf"
,
font_size
,
encoding
=
"utf-8"
)
new_txt
=
str
(
count
)
+
': '
+
txt
+
' '
+
'%.3f'
%
(
scores
[
count
])
new_txt
=
str
(
count
)
+
': '
+
txt
+
' '
+
'%.3f'
%
(
scores
[
count
])
draw_txt
.
text
(
draw_txt
.
text
(
(
20
,
gap
*
(
count
+
1
)),
new_txt
,
txt_color
,
font
=
font
)
(
20
,
gap
*
(
count
+
1
)),
new_txt
,
txt_color
,
font
=
font
)
count
+=
1
count
+=
1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录