Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
38192934
Commit
38192934
authored
Jun 24, 2020
by
zhangxin
Browse files
有几行没有用新的代码,旧代码注释了。
parent
9136cba8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+6
-6
No files found.
tools/infer/predict_rec.py
View file @
38192934
...
...
@@ -64,11 +64,11 @@ class TextRecognizer(object):
def
__call__
(
self
,
img_list
):
img_num
=
len
(
img_list
)
#
统计所有文本条的宽高比
#
Calculate the aspect ratio of all text bars
width_list
=
[]
for
img
in
img_list
:
width_list
.
append
(
img
.
shape
[
1
]
/
float
(
img
.
shape
[
0
]))
#
对于文本框比较多且长短差异较大的情况下,通过排序再组合batch可以明显加速识别
#
Sorting can be accelerated
indices
=
np
.
argsort
(
np
.
array
(
width_list
))
# rec_res = []
...
...
@@ -80,13 +80,13 @@ class TextRecognizer(object):
norm_img_batch
=
[]
max_wh_ratio
=
0
for
ino
in
range
(
beg_img_no
,
end_img_no
):
h
,
w
=
img_list
[
ino
].
shape
[
0
:
2
]
#
h, w = img_list[indices[ino]].shape[0:2]
#
h, w = img_list[ino].shape[0:2]
h
,
w
=
img_list
[
indices
[
ino
]].
shape
[
0
:
2
]
wh_ratio
=
w
*
1.0
/
h
max_wh_ratio
=
max
(
max_wh_ratio
,
wh_ratio
)
for
ino
in
range
(
beg_img_no
,
end_img_no
):
norm_img
=
self
.
resize_norm_img
(
img_list
[
ino
],
max_wh_ratio
)
#
norm_img = self.resize_norm_img(img_list[indices[ino]], max_wh_ratio)
#
norm_img = self.resize_norm_img(img_list[ino], max_wh_ratio)
norm_img
=
self
.
resize_norm_img
(
img_list
[
indices
[
ino
]],
max_wh_ratio
)
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img_batch
.
append
(
norm_img
)
norm_img_batch
=
np
.
concatenate
(
norm_img_batch
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment