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
5983e1af
Commit
5983e1af
authored
Nov 27, 2020
by
WenmuZhou
Browse files
Remove redundant functions
parent
835bfa45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
9 deletions
+1
-9
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+1
-9
No files found.
ppocr/data/imaug/label_ops.py
View file @
5983e1af
...
@@ -123,7 +123,7 @@ class BaseRecLabelEncode(object):
...
@@ -123,7 +123,7 @@ class BaseRecLabelEncode(object):
[sum(text_lengths)] = [text_index_0 + text_index_1 + ... + text_index_(n - 1)]
[sum(text_lengths)] = [text_index_0 + text_index_1 + ... + text_index_(n - 1)]
length: length of each text. [batch_size]
length: length of each text. [batch_size]
"""
"""
if
len
(
text
)
>
self
.
max_text_len
:
if
len
(
text
)
==
0
or
len
(
text
)
>
self
.
max_text_len
:
return
None
return
None
if
self
.
character_type
==
"en"
:
if
self
.
character_type
==
"en"
:
text
=
text
.
lower
()
text
=
text
.
lower
()
...
@@ -138,9 +138,6 @@ class BaseRecLabelEncode(object):
...
@@ -138,9 +138,6 @@ class BaseRecLabelEncode(object):
return
None
return
None
return
text_list
return
text_list
def
get_ignored_tokens
(
self
):
return
[
0
]
# for ctc blank
class
CTCLabelEncode
(
BaseRecLabelEncode
):
class
CTCLabelEncode
(
BaseRecLabelEncode
):
""" Convert between text-label and text-index """
""" Convert between text-label and text-index """
...
@@ -193,11 +190,6 @@ class AttnLabelEncode(BaseRecLabelEncode):
...
@@ -193,11 +190,6 @@ class AttnLabelEncode(BaseRecLabelEncode):
text
=
self
.
encode
(
text
)
text
=
self
.
encode
(
text
)
return
text
return
text
def
get_ignored_tokens
(
self
):
beg_idx
=
self
.
get_beg_end_flag_idx
(
"beg"
)
end_idx
=
self
.
get_beg_end_flag_idx
(
"end"
)
return
[
beg_idx
,
end_idx
]
def
get_beg_end_flag_idx
(
self
,
beg_or_end
):
def
get_beg_end_flag_idx
(
self
,
beg_or_end
):
if
beg_or_end
==
"beg"
:
if
beg_or_end
==
"beg"
:
idx
=
np
.
array
(
self
.
dict
[
self
.
beg_str
])
idx
=
np
.
array
(
self
.
dict
[
self
.
beg_str
])
...
...
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