From 39a34ac80f557976ebe57593eba7661bde025a44 Mon Sep 17 00:00:00 2001 From: caopu <2788787973@qq.com> Date: Mon, 29 Mar 2021 11:23:33 +0800 Subject: [PATCH] fix srn_postprocess --- ppocr/postprocess/rec_postprocess.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppocr/postprocess/rec_postprocess.py b/ppocr/postprocess/rec_postprocess.py index b0517982..c769b7b4 100644 --- a/ppocr/postprocess/rec_postprocess.py +++ b/ppocr/postprocess/rec_postprocess.py @@ -216,6 +216,7 @@ class SRNLabelDecode(BaseRecLabelDecode): character_type='en', use_space_char=False, **kwargs): + self.max_text_length = kwargs['max_text_length'] super(SRNLabelDecode, self).__init__(character_dict_path, character_type, use_space_char) @@ -229,9 +230,9 @@ class SRNLabelDecode(BaseRecLabelDecode): preds_idx = np.argmax(pred, axis=1) preds_prob = np.max(pred, axis=1) - preds_idx = np.reshape(preds_idx, [-1, 25]) + preds_idx = np.reshape(preds_idx, [-1, self.max_text_length]) - preds_prob = np.reshape(preds_prob, [-1, 25]) + preds_prob = np.reshape(preds_prob, [-1, self.max_text_length]) text = self.decode(preds_idx, preds_prob) -- GitLab