def __call__(self, img): """ Args: img (numpy ndarray): Image to be scaled. Returns: numpy ndarray: Rescaled image. """ return F.resize(img, self.size, self.interpolation)
def __call__(self, img): """ Args: img (numpy ndarray): Image to be scaled. Returns: numpy ndarray: Rescaled image. """ percent = float(self.size) / min(img.shape[0], img.shape[1]) resized_width = int(round(img.shape[1] * percent)) resized_height = int(round(img.shape[0] * percent)) return F.resize(img, (resized_height, resized_width), self.interpolation)
def __call__(self, imgs): """ Args: imgs (numpy ndarray): Image sequence (time*height*width*channel) to be scaled. Returns: numpy ndarray: Rescaled image sequence. """ # Apply to all images output_imgs = [] for I in imgs: output_imgs.append(F.resize(I, self.size, self.interpolation)) return np.array(output_imgs)