diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index 1b4446a6717bccdc5b3de4ba70e058885479be84..6c5c36cf86febef406609bf5022cfd2ee776756f 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -143,7 +143,9 @@ class TextDetector(object): if self.use_onnx: img_h, img_w = self.input_tensor.shape[2:] - if img_h is not None and img_w is not None and img_h > 0 and img_w > 0: + if isinstance(img_h, str) or isinstance(img_w, str): + pass + elif img_h is not None and img_w is not None and img_h > 0 and img_w > 0: pre_process_list[0] = { 'DetResizeForTest': { 'image_shape': [img_h, img_w] diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index b3ef557c09fb74990b65c266afa5d5c77960b7ed..d3231545a99cb42d71ed3f78a0f915825c3f821f 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -173,9 +173,10 @@ class TextRecognizer(object): imgW = int((imgH * max_wh_ratio)) if self.use_onnx: w = self.input_tensor.shape[3:][0] - if w is not None and w > 0: + if isinstance(w, str): + pass + elif w is not None and w > 0: imgW = w - h, w = img.shape[:2] ratio = w / float(h) if math.ceil(imgH * ratio) > imgW: