CTC token update fix
This commit is contained in:
parent
f48694a2af
commit
017df17d56
4
utils.py
4
utils.py
|
@ -6,12 +6,12 @@ class CTCLabelConverter(object):
|
||||||
|
|
||||||
def __init__(self, character):
|
def __init__(self, character):
|
||||||
# character (str): set of the possible characters.
|
# character (str): set of the possible characters.
|
||||||
list_token = ['[BLANK]'] # '[BLANK] ' for blank token (index 0)
|
list_token = ['[blank]'] # dummy '[blank]' token for CTCLoss (index 0)
|
||||||
list_character = list(character)
|
list_character = list(character)
|
||||||
self.character = list_token + list_character
|
self.character = list_token + list_character
|
||||||
|
|
||||||
self.dict = {}
|
self.dict = {}
|
||||||
for i, char in enumerate(self.character):
|
for i, char in enumerate(list_character):
|
||||||
# NOTE: 0 is reserved for 'blank' token required by CTCLoss
|
# NOTE: 0 is reserved for 'blank' token required by CTCLoss
|
||||||
self.dict[char] = i + 1
|
self.dict[char] = i + 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue