提交 ab0b4e74 编写于 作者: A andyjpaddle

fix vl infer

上级 7a706ada
...@@ -219,10 +219,7 @@ class VLRecResizeImg(object): ...@@ -219,10 +219,7 @@ class VLRecResizeImg(object):
def __call__(self, data): def __call__(self, data):
img = data['image'] img = data['image']
if self.infer_mode and self.character_dict_path is not None:
norm_img, valid_ratio = resize_norm_img_chinese(img,
self.image_shape)
else:
imgC, imgH, imgW = self.image_shape imgC, imgH, imgW = self.image_shape
resized_image = cv2.resize( resized_image = cv2.resize(
img, (imgW, imgH), interpolation=cv2.INTER_LINEAR) img, (imgW, imgH), interpolation=cv2.INTER_LINEAR)
......
...@@ -166,6 +166,7 @@ class TextRecognizer(object): ...@@ -166,6 +166,7 @@ class TextRecognizer(object):
def resize_norm_img_vl(self, img, image_shape): def resize_norm_img_vl(self, img, image_shape):
imgC, imgH, imgW = image_shape imgC, imgH, imgW = image_shape
img = img[:, :, ::-1] # bgr2rgb
resized_image = cv2.resize( resized_image = cv2.resize(
img, (imgW, imgH), interpolation=cv2.INTER_LINEAR) img, (imgW, imgH), interpolation=cv2.INTER_LINEAR)
resized_image = resized_image.astype('float32') resized_image = resized_image.astype('float32')
......
...@@ -131,7 +131,6 @@ def main(): ...@@ -131,7 +131,6 @@ def main():
if config['Architecture']['algorithm'] == "SAR": if config['Architecture']['algorithm'] == "SAR":
valid_ratio = np.expand_dims(batch[-1], axis=0) valid_ratio = np.expand_dims(batch[-1], axis=0)
img_metas = [paddle.to_tensor(valid_ratio)] img_metas = [paddle.to_tensor(valid_ratio)]
images = np.expand_dims(batch[0], axis=0) images = np.expand_dims(batch[0], axis=0)
images = paddle.to_tensor(images) images = paddle.to_tensor(images)
if config['Architecture']['algorithm'] == "SRN": if config['Architecture']['algorithm'] == "SRN":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册