提交 e7d24ac8 编写于 作者: L LDOUBLEV

fix comment

上级 0f4d92b6
...@@ -43,7 +43,6 @@ Architecture: ...@@ -43,7 +43,6 @@ Architecture:
Backbone: Backbone:
name: ResNet name: ResNet
layers: 34 layers: 34
Neck: Neck:
name: SequenceEncoder name: SequenceEncoder
encoder_type: rnn encoder_type: rnn
...@@ -52,7 +51,6 @@ Architecture: ...@@ -52,7 +51,6 @@ Architecture:
name: AttentionHead # AttentionHead name: AttentionHead # AttentionHead
hidden_size: 256 # hidden_size: 256 #
l2_decay: 0.00001 l2_decay: 0.00001
Loss: Loss:
name: AttentionLoss name: AttentionLoss
......
...@@ -192,25 +192,6 @@ class AttnLabelDecode(BaseRecLabelDecode): ...@@ -192,25 +192,6 @@ class AttnLabelDecode(BaseRecLabelDecode):
label = self.decode(label, is_remove_duplicate=False) label = self.decode(label, is_remove_duplicate=False)
return text, label return text, label
def encoder(self, labels, labels_length):
"""
used to encoder labels readed from LMDB dataset, forexample:
[35, 25, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] encode to
'you': [0, 35,25,31, 37, 0, ...] 'sos'you'eos'
"""
if isinstance(labels, paddle.Tensor):
labels = labels.numpy()
batch_max_length = labels.shape[
1] + 2 # add start token 'sos' and end token 'eos'
new_labels = np.zeros(
[labels.shape[0], batch_max_length]).astype(np.int64)
for i in range(labels.shape[0]):
new_labels[i, 1:1 + labels_length[i]] = labels[i, :labels_length[
i]] # new_labels[i, 0] = 'sos' token
new_labels[i, labels_length[i] + 1] = len(
self.character) - 1 # add end charactor 'eos' token
return new_labels
def get_ignored_tokens(self): def get_ignored_tokens(self):
beg_idx = self.get_beg_end_flag_idx("beg") beg_idx = self.get_beg_end_flag_idx("beg")
end_idx = self.get_beg_end_flag_idx("end") end_idx = self.get_beg_end_flag_idx("end")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册