mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2026-09-21 13:23:18 +08:00
fix onnx for dynamic shape (#8812)
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user