GANs/Pix2Pix_Isola_et_al_2017/dataset.py
def apply_transforms(self, face, comic):
        """Apply the same transforms to the input and the target."""
        common_transform = transforms.Compose([transforms.Resize((256, 256)),
                                               transforms.ToTensor()])

        normalize_face = transforms.Normalize(mean=[0.5129, 0.4136, 0.3671],
                                              std=[0.2372, 0.1972, 0.1883])

        normalize_comic = transforms.Normalize(mean=[0.4445, 0.3650, 0.3226],
                                               std=[0.2594, 0.2051, 0.1840])

        face = normalize_face(common_transform(face))
        comic = normalize_comic(common_transform(comic))

        if self.train:
            train_transform = transforms.Compose([
                transforms.RandomHorizontalFlip(p=0.5),
                transforms.ColorJitter()])
            face = train_transform(face)
            comic = train_transform(comic)

        return face, comic
Apply the same transforms to the input and the target.
Apply the same transforms to the input and the target.
Apply the same transforms to the input and the target .
def apply_transforms(self, face, comic):
        common_transform = transforms.Compose([transforms.Resize((256, 256)),
                                               transforms.ToTensor()])
        normalize_face = transforms.Normalize(mean=[0.5129, 0.4136, 0.3671],
                                              std=[0.2372, 0.1972, 0.1883])
        normalize_comic = transforms.Normalize(mean=[0.4445, 0.3650, 0.3226],
                                               std=[0.2594, 0.2051, 0.1840])
        face = normalize_face(common_transform(face))
        comic = normalize_comic(common_transform(comic))
        if self.train:
            train_transform = transforms.Compose([
                transforms.RandomHorizontalFlip(p=0.5),
                transforms.ColorJitter()])
            face = train_transform(face)
            comic = train_transform(comic)
        return face, comic
def apply_transforms ( self , face , comic ) : common_transform = transforms . Compose ( [ transforms . Resize ( ( 256 , 256 ) ) , transforms . ToTensor ( ) ] ) normalize_face = transforms . Normalize ( mean = [ 0.5129 , 0.4136 , 0.3671 ] , std = [ 0.2372 , 0.1972 , 0.1883 ] ) normalize_comic = transforms . Normalize ( mean = [ 0.4445 , 0.3650 , 0.3226 ] , std = [ 0.2594 , 0.2051 , 0.1840 ] ) face = normalize_face ( common_transform ( face ) ) comic = normalize_comic ( common_transform ( comic ) ) if self . train : train_transform = transforms . Compose ( [ transforms . RandomHorizontalFlip ( p = 0.5 ) , transforms . ColorJitter ( ) ] ) face = train_transform ( face ) comic = train_transform ( comic ) return face , comic
Apply the same transforms to the input and the target.
Apply the same transforms to the input and the target .
"""Apply the same transforms to the input and the target."""
self
face
comic