From 3bfee0599b41dbb749f6336f97cba56131ed3858 Mon Sep 17 00:00:00 2001 From: ms_yan <6576637+ms_yan@user.noreply.gitee.com> Date: Sun, 3 Jan 2021 15:08:20 +0800 Subject: [PATCH] expose area interpolation for resize --- mindspore/dataset/vision/c_transforms.py | 5 ++++- mindspore/dataset/vision/utils.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mindspore/dataset/vision/c_transforms.py b/mindspore/dataset/vision/c_transforms.py index 19d52bdba0..d1039dcf7f 100644 --- a/mindspore/dataset/vision/c_transforms.py +++ b/mindspore/dataset/vision/c_transforms.py @@ -58,7 +58,8 @@ from .validators import check_prob, check_crop, check_resize_interpolation, chec DE_C_INTER_MODE = {Inter.NEAREST: cde.InterpolationMode.DE_INTER_NEAREST_NEIGHBOUR, Inter.LINEAR: cde.InterpolationMode.DE_INTER_LINEAR, - Inter.CUBIC: cde.InterpolationMode.DE_INTER_CUBIC} + Inter.CUBIC: cde.InterpolationMode.DE_INTER_CUBIC, + Inter.AREA: cde.InterpolationMode.DE_INTER_AREA} DE_C_BORDER_TYPE = {Border.CONSTANT: cde.BorderType.DE_BORDER_CONSTANT, Border.EDGE: cde.BorderType.DE_BORDER_EDGE, @@ -731,6 +732,8 @@ class Resize(cde.ResizeOp): - Inter.BICUBIC, means interpolation method is bicubic interpolation. + - Inter.AREA, means interpolation method is pixel area interpolation. + Examples: >>> from mindspore.dataset.vision import Inter >>> decode_op = c_vision.Decode() diff --git a/mindspore/dataset/vision/utils.py b/mindspore/dataset/vision/utils.py index c2cd397803..08d0fbb690 100644 --- a/mindspore/dataset/vision/utils.py +++ b/mindspore/dataset/vision/utils.py @@ -22,6 +22,7 @@ class Inter(IntEnum): ANTIALIAS = 1 BILINEAR = LINEAR = 2 BICUBIC = CUBIC = 3 + AREA = 4 # Padding Mode, Border Type