diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 4c16f929352640f2b770fe2ff94fd4497f1308f5..d700b5c0f0f521bfcbe7440b711b0c2f11cddf50 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -89,6 +89,7 @@ class TextRecognizer(object): imgC, imgH, imgW = self.rec_image_shape assert imgC == img.shape[2] if self.character_type == "ch": + max_wh_ratio = max(max_wh_ratio, imgW / imgH) imgW = int((32 * max_wh_ratio)) h, w = img.shape[:2] ratio = w / float(h)