diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 1989f524c21d519f879290bcc72bc1b282a93772..77dc82aad25bec5023367d051ec195001c4fd8e7 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -63,8 +63,9 @@ class TextRecognizer(object): def resize_norm_img(self, img, max_wh_ratio): imgC, imgH, imgW = self.rec_image_shape assert imgC == img.shape[2] + wh_ratio = max(max_wh_ratio, imgW * 1.0 / imgH) if self.character_type == "ch": - imgW = int((32 * max_wh_ratio)) + imgW = int((32 * wh_ratio)) h, w = img.shape[:2] ratio = w / float(h) if math.ceil(imgH * ratio) > imgW: