diff --git a/official/cv/deeptext/postprocess.py b/official/cv/deeptext/postprocess.py index dd734a81483bf146650b22650de2d7883e69498c..ed31538214c36e6db79b3de950b9a836d27a0207 100644 --- a/official/cv/deeptext/postprocess.py +++ b/official/cv/deeptext/postprocess.py @@ -37,8 +37,12 @@ def get_pred(file, result_path): def get_gt_bboxes_labels(label_file, img_file): img_data = np.array(Image.open(img_file)) - img_data, w_scale, h_scale = cv2.resize( + img_data = cv2.resize( img_data, (config.img_width, config.img_height), interpolation=cv2.INTER_LINEAR) + h, w = img_data.shape[:2] + h_scale = config.img_height / h + w_scale = config.img_width / w + scale_factor = np.array( [w_scale, h_scale, w_scale, h_scale], dtype=np.float32) img_shape = (config.img_height, config.img_width, 1.0) diff --git a/official/cv/deeptext/src/dataset.py b/official/cv/deeptext/src/dataset.py index 3db858b99d389d7d7273db0bdce34f2e17df237a..c5bc7f3e5bbaaa9dbd61eb7af1f39890b6bc1fd1 100644 --- a/official/cv/deeptext/src/dataset.py +++ b/official/cv/deeptext/src/dataset.py @@ -166,8 +166,12 @@ class Expand: def resize_column(img, img_shape, gt_bboxes, gt_label, gt_num): """resize operation for image""" img_data = img - img_data, w_scale, h_scale = cv2.resize( + img_data = cv2.resize( img_data, (config.img_width, config.img_height), interpolation=cv2.INTER_LINEAR) + h, w = img_data.shape[:2] + h_scale = config.img_height / h + w_scale = config.img_width / w + scale_factor = np.array( [w_scale, h_scale, w_scale, h_scale], dtype=np.float32) img_shape = (config.img_height, config.img_width, 1.0) @@ -184,8 +188,12 @@ def resize_column(img, img_shape, gt_bboxes, gt_label, gt_num): def resize_column_test(img, img_shape, gt_bboxes, gt_label, gt_num): """resize operation for image of eval""" img_data = img - img_data, w_scale, h_scale = cv2.resize( + img_data = cv2.resize( img_data, (config.img_width, config.img_height), interpolation=cv2.INTER_LINEAR) + h, w = img_data.shape[:2] + h_scale = config.img_height / h + w_scale = config.img_width / w + scale_factor = np.array( [w_scale, h_scale, w_scale, h_scale], dtype=np.float32) img_shape = (config.img_height, config.img_width) diff --git a/official/cv/maskrcnn_mobilenetv1/src/dataset.py b/official/cv/maskrcnn_mobilenetv1/src/dataset.py index 7aee62ca6319c94df92f66c169c4942f18cbe4ca..7813377b089504a5cb55f291c0bd9d9b29cef4e0 100644 --- a/official/cv/maskrcnn_mobilenetv1/src/dataset.py +++ b/official/cv/maskrcnn_mobilenetv1/src/dataset.py @@ -266,7 +266,7 @@ def resize_column(img, img_shape, gt_bboxes, gt_label, gt_num, gt_mask): def resize_column_test(img, img_shape, gt_bboxes, gt_label, gt_num, gt_mask): """resize operation for image of eval""" img_data = img - img_data, w_scale, h_scale = cv2.resize( + img_data = cv2.resize( img_data, (config.img_width, config.img_height), interpolation=cv2.INTER_LINEAR) h, w = img_data.shape[:2] h_scale = config.img_height / h