(self, img, lbl)
return F.crop(img, i, j, h, w), F.crop(lbl, i, j, h, w)
Args:
            img (PIL Image): Image to be cropped.
            lbl (PIL Image): Label to be cropped.
        Returns:
            PIL Image: Cropped image.
            PIL Image: Cropped label.
Args:
            img (PIL Image): Image to be cropped.
            lbl (PIL Image): Label to be cropped.
        Returns:
            PIL Image: Cropped image.
            PIL Image: Cropped label.
Args : img ( PIL Image ) : Image to be cropped . lbl ( PIL Image ) : Label to be cropped . Returns : PIL Image : Cropped image . PIL Image : Cropped label .
def __call__(self, img, lbl):
        """
        Args:
            img (PIL Image): Image to be cropped.
            lbl (PIL Image): Label to be cropped.
        Returns:
            PIL Image: Cropped image.
            PIL Image: Cropped label.
        """
        assert img.size == lbl.size, 'size of img and lbl should be the same. %s, %s'%(img.size, lbl.size)
        if self.padding > 0:
            img = F.pad(img, self.padding)
            lbl = F.pad(lbl, self.padding)

        # pad the width if needed
        if self.pad_if_needed and img.size[0] < self.size[1]:
            img = F.pad(img, padding=int((1 + self.size[1] - img.size[0]) / 2))
            lbl = F.pad(lbl, padding=int((1 + self.size[1] - lbl.size[0]) / 2))

        # pad the height if needed
        if self.pad_if_needed and img.size[1] < self.size[0]:
            img = F.pad(img, padding=int((1 + self.size[0] - img.size[1]) / 2))
            lbl = F.pad(lbl, padding=int((1 + self.size[0] - lbl.size[1]) / 2))

        i, j, h, w = self.get_params(img, self.size)

        return F.crop(img, i, j, h, w), F.crop(lbl, i, j, h, w)
def __call__ ( self , img , lbl ) : assert img . size == lbl . size , 'size of img and lbl should be the same. %s, %s' % ( img . size , lbl . size ) if self . padding > 0 : img = F . pad ( img , self . padding ) lbl = F . pad ( lbl , self . padding ) # pad the width if needed if self . pad_if_needed and img . size [ 0 ] < self . size [ 1 ] : img = F . pad ( img , padding = int ( ( 1 + self . size [ 1 ] - img . size [ 0 ] ) / 2 ) ) lbl = F . pad ( lbl , padding = int ( ( 1 + self . size [ 1 ] - lbl . size [ 0 ] ) / 2 ) ) # pad the height if needed if self . pad_if_needed and img . size [ 1 ] < self . size [ 0 ] : img = F . pad ( img , padding = int ( ( 1 + self . size [ 0 ] - img . size [ 1 ] ) / 2 ) ) lbl = F . pad ( lbl , padding = int ( ( 1 + self . size [ 0 ] - lbl . size [ 1 ] ) / 2 ) ) i , j , h , w = self . get_params ( img , self . size ) return F . crop ( img , i , j , h , w ) , F . crop ( lbl , i , j , h , w )