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
1c8cddf4
Commit
1c8cddf4
authored
Jun 30, 2020
by
tink2123
Browse files
fix resize norm for ch
parent
87ce916a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
ppocr/data/rec/img_tools.py
ppocr/data/rec/img_tools.py
+5
-3
No files found.
ppocr/data/rec/img_tools.py
View file @
1c8cddf4
...
@@ -53,6 +53,7 @@ def resize_norm_img(img, image_shape):
...
@@ -53,6 +53,7 @@ def resize_norm_img(img, image_shape):
def
resize_norm_img_chinese
(
img
,
image_shape
):
def
resize_norm_img_chinese
(
img
,
image_shape
):
imgC
,
imgH
,
imgW
=
image_shape
imgC
,
imgH
,
imgW
=
image_shape
# todo: change to 0 and modified image shape
# todo: change to 0 and modified image shape
imgC
=
3
max_wh_ratio
=
0
max_wh_ratio
=
0
h
,
w
=
img
.
shape
[
0
],
img
.
shape
[
1
]
h
,
w
=
img
.
shape
[
0
],
img
.
shape
[
1
]
ratio
=
w
*
1.0
/
h
ratio
=
w
*
1.0
/
h
...
@@ -97,10 +98,11 @@ def process_image(img,
...
@@ -97,10 +98,11 @@ def process_image(img,
max_text_length
=
None
,
max_text_length
=
None
,
tps
=
None
,
tps
=
None
,
infer_mode
=
False
):
infer_mode
=
False
):
if
not
infer_mode
and
(
char_ops
.
character_type
==
"en"
or
tps
!=
None
):
if
infer_mode
and
char_ops
.
character_type
==
"ch"
and
not
tps
:
norm_img
=
resize_norm_img
(
img
,
image_shape
)
else
:
norm_img
=
resize_norm_img_chinese
(
img
,
image_shape
)
norm_img
=
resize_norm_img_chinese
(
img
,
image_shape
)
else
:
norm_img
=
resize_norm_img
(
img
,
image_shape
)
norm_img
=
norm_img
[
np
.
newaxis
,
:]
norm_img
=
norm_img
[
np
.
newaxis
,
:]
if
label
is
not
None
:
if
label
is
not
None
:
# char_num = char_ops.get_char_num()
# char_num = char_ops.get_char_num()
...
...
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