Пример #1
0
    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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
    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