From e7d24ac8b87a76d36c1f0e022d450db633e00017 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 1 Feb 2021 06:41:45 +0000 Subject: [PATCH] fix comment --- configs/rec/rec_r34_vd_tps_bilstm_att.yml | 2 -- ppocr/postprocess/rec_postprocess.py | 19 ------------------- 2 files changed, 21 deletions(-) diff --git a/configs/rec/rec_r34_vd_tps_bilstm_att.yml b/configs/rec/rec_r34_vd_tps_bilstm_att.yml index f42bfdcc..7be34b9c 100644 --- a/configs/rec/rec_r34_vd_tps_bilstm_att.yml +++ b/configs/rec/rec_r34_vd_tps_bilstm_att.yml @@ -43,7 +43,6 @@ Architecture: Backbone: name: ResNet layers: 34 - Neck: name: SequenceEncoder encoder_type: rnn @@ -52,7 +51,6 @@ Architecture: name: AttentionHead # AttentionHead hidden_size: 256 # l2_decay: 0.00001 - Loss: name: AttentionLoss diff --git a/ppocr/postprocess/rec_postprocess.py b/ppocr/postprocess/rec_postprocess.py index d4991222..af243caa 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -192,25 +192,6 @@ class AttnLabelDecode(BaseRecLabelDecode): label = self.decode(label, is_remove_duplicate=False) 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): beg_idx = self.get_beg_end_flag_idx("beg") end_idx = self.get_beg_end_flag_idx("end")