From a0fd1a48a1b54ecd80f7439d31aaec2466e14beb Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Fri, 12 Mar 2021 17:15:48 +0800 Subject: [PATCH] fix srn infer error when use custom max_text_length --- tools/infer/predict_rec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 1cb6e01b..24388026 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -41,6 +41,7 @@ class TextRecognizer(object): self.character_type = args.rec_char_type self.rec_batch_num = args.rec_batch_num self.rec_algorithm = args.rec_algorithm + self.max_text_length = args.max_text_length postprocess_params = { 'name': 'CTCLabelDecode', "character_type": args.rec_char_type, @@ -186,8 +187,9 @@ class TextRecognizer(object): norm_img = norm_img[np.newaxis, :] norm_img_batch.append(norm_img) else: - norm_img = self.process_image_srn( - img_list[indices[ino]], self.rec_image_shape, 8, 25) + norm_img = self.process_image_srn(img_list[indices[ino]], + self.rec_image_shape, 8, + self.max_text_length) encoder_word_pos_list = [] gsrm_word_pos_list = [] gsrm_slf_attn_bias1_list = [] -- GitLab