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
9e9a9a45
Commit
9e9a9a45
authored
Jun 24, 2020
by
zhangxin
Browse files
识别infer时改回不同字符类型采用不同归一化
parent
38192934
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+7
-2
No files found.
tools/infer/predict_rec.py
View file @
9e9a9a45
...
...
@@ -50,9 +50,14 @@ class TextRecognizer(object):
def
resize_norm_img
(
self
,
img
,
max_wh_ratio
):
imgC
,
imgH
,
imgW
=
self
.
rec_image_shape
assert
imgC
==
img
.
shape
[
2
]
if
self
.
character_type
==
"ch"
:
imgW
=
int
(
math
.
ceil
(
32
*
max_wh_ratio
))
h
,
w
=
img
.
shape
[:
2
]
resized_w
=
int
(
math
.
ceil
(
imgH
*
w
/
float
(
h
)))
ratio
=
w
/
float
(
h
)
if
math
.
ceil
(
imgH
*
ratio
)
>
imgW
:
resized_w
=
imgW
else
:
resized_w
=
int
(
math
.
ceil
(
imgH
*
ratio
))
resized_image
=
cv2
.
resize
(
img
,
(
resized_w
,
imgH
),
interpolation
=
cv2
.
INTER_CUBIC
)
resized_image
=
resized_image
.
astype
(
'float32'
)
resized_image
=
resized_image
.
transpose
((
2
,
0
,
1
))
/
255
...
...
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