def __call__(self, image, target): t = random.random() if t < self.flip_prob: image = F.hflip(image) target = target if (type(target) == str or t >= self.flip_prob) else F.hflip(target) return image, target
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.hflip(img),F.hflip(target) return img, target
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.hflip(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.hflip(sample) return sample
def __call__(self, img): """random Args: img (numpy ndarray): Image to be flipped. Returns: numpy ndarray: Randomly flipped image. """ # if random.random() < self.p: # print('flip') # return F.hflip(img) if random.random() < self.p: return F.hflip(img) return img