Resize image by cv2 module.
    Args:
        img (numpy.ndarray): Image array to save.
            Image shape is considered as (height, width, channel) for RGB or (height, width) for gray-scale by default.
        size (tupple of int): (width, height).
        channel_first: bool
            This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
            Default value is False, which means the img shape is (height, width, channel)
        interpolate (str):
            must be one of ["nearest", "bilinear", "bicubic", "lanczos"]
    Returns:
         numpy.ndarray whose shape is (size[1], size[0], channel) or (size[1], size[0])

def imresize(img, size, interpolate="bilinear", channel_first=False):
    """
    Resize image by cv2 module.
    Args:
        img (numpy.ndarray): Image array to save.
            Image shape is considered as (height, width, channel) for RGB or (height, width) for gray-scale by default.
        size (tupple of int): (width, height).
        channel_first: bool
            This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
            Default value is False, which means the img shape is (height, width, channel)
        interpolate (str):
            must be one of ["nearest", "bilinear", "bicubic", "lanczos"]
    Returns:
         numpy.ndarray whose shape is (size[1], size[0], channel) or (size[1], size[0])
    """

    img = _imresize_before(img, size, channel_first,
                           interpolate, list(interpolations_map.keys()))

    dtype = img.dtype

    expand_flag = len(img.shape) == 3 and img.shape[-1] == 1
    # if img shape is (h, w, 1),
    # cv2.reshape automatically shrink the last channel and the shape of returned img is (h, w)

    resized = cv2.resize(
        img, size, interpolation=interpolations_map[interpolate])

    if expand_flag:
        resized = np.expand_dims(resized, axis=-1)

    return _imresize_after(resized, channel_first).astype(dtype)