def __call__(self, img, target): """ Args: img (PIL Image): Image to be flipped. Returns: PIL Image: Randomly flipped image. """ if random.random() < 0.5: return F.vflip(img), F.vflip(target) return img, target
def __call__(self, img): """ Args: img (numpy ndarray): Image to be flipped. Returns: numpy ndarray: Randomly flipped image. """ if random.random() < self.p: return F.vflip(img) return img
def __call__(self, img): """ Args: img (PIL Image): Image to be flipped. Returns: PIL Image: Randomly flipped image. """ if random.random() < self.p: return F.vflip(img) return img
def __call__(self, sample): """ Args: img (PIL Image): Image to be flipped. Returns: PIL Image: Randomly flipped image. """ if random.random() < 0.5: return F.vflip(sample) return sample