示例#1
0
 def transform_tr(self, sample):
     if self.table == {}:
         composed_transforms = transforms.Compose([
             tr.RandomHorizontalFlip(),
             tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
             #tr.Remap(self.building_table, self.nonbuilding_table, self.channels)
             tr.RandomGaussianBlur(),
             #tr.ConvertFromInts(),
             #tr.PhotometricDistort(),
             tr.Normalize(mean=self.source_dist['mean'],
                          std=self.source_dist['std']),
             tr.ToTensor(),
         ])
     else:
         composed_transforms = transforms.Compose([
             tr.RandomHorizontalFlip(),
             tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
             tr.Remap(self.table, self.channels),
             tr.RandomGaussianBlur(),
             #tr.ConvertFromInts(),
             #tr.PhotometricDistort(),
             tr.Normalize(mean=self.source_dist['mean'],
                          std=self.source_dist['std']),
             tr.ToTensor(),
         ])
     return composed_transforms(sample)
示例#2
0
 def transform_tr(self, sample):
     composed_transforms = transforms.Compose([
         tr.RandomHorizontalFlip(),
         tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
         tr.Normalize(),
         tr.ToTensor(),
     ])
     return composed_transforms(sample)
示例#3
0
 def transform_tr(self, sample):
     composed_transforms = transforms.Compose([
         # tr.RandomHorizontalFlip(),
         tr.RandomScaleCrop(base_size=self.args.base_size, crop_size=self.args.crop_size, fill=255),
         # tr.RandomGaussianBlur(),
         tr.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)),
         tr.ToTensor()])
     return composed_transforms(sample)
 def transform_tr(self, sample):
     train_transforms = list()
     train_transforms.append(tr.RandomHorizontalFlip())
     train_transforms.append(tr.RandomScaleCrop(base_size=self.cfg.LOAD_SIZE, crop_size=self.cfg.FINE_SIZE))
     train_transforms.append(tr.RandomGaussianBlur())
     train_transforms.append(tr.ToTensor())
     train_transforms.append(tr.Normalize(mean=self.cfg.MEAN, std=self.cfg.STD, ms_targets=self.ms_targets))
     composed_transforms = transforms.Compose(train_transforms)
     return composed_transforms(sample)
示例#5
0
 def transform_tr(self, sample):
     composed_transforms = transforms.Compose([
         tr.RandomHorizontalFlip(),
         tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
         tr.RandomGaussianBlur(),
         tr.Normalize(mean=self.source_dist['mean'], std=self.source_dist['std']),
         tr.ToTensor(),
     ])
     return composed_transforms(sample)
示例#6
0
 def transform_finetune(self, sample):
     composed_transforms = transforms.Compose([
         tr.RandomHorizontalFlip(),
         # tr.RandomCrop(crop_size = 200),
         tr.RandomScaleCrop(base_size=600, crop_size=400, fill=0),
         tr.RandomGaussianBlur(),
         tr.Normalize(),
         tr.ToTensor()
     ])
     return composed_transforms(sample)
示例#7
0
 def transform_pair_train(self, sample):
     composed_transforms = transforms.Compose([
         tr.RandomHorizontalFlip(),
         tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
         #tr.RandomGaussianBlur(),
         tr.HorizontalFlip(),
         tr.GaussianBlur(),
         tr.Normalize(if_pair=True),
         tr.ToTensor(if_pair=True),
     ])
     return composed_transforms(sample)
示例#8
0
 def transform_pair_train(self, sample):
     composed_transforms = transforms.Compose([
         tr.RandomHorizontalFlip(),
         tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
         tr.RandomGaussianBlur(),
         tr.ColorDistort(if_pair=True),
         #tr.CropAndResize(if_pair=True),
         tr.Normalize(mean=self.source_dist['mean'],
                      std=self.source_dist['std'],
                      if_pair=True),
         tr.ToTensor(if_pair=True),
     ])
     return composed_transforms(sample)
示例#9
0
    def transform_tr(self, sample):
        composed_transforms = transforms.Compose([
            tr.RandomHorizontalFlip(),
            tr.RandomVerticalFlip(),
            tr.RandomRotate(180),
            tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
            tr.RandomGaussianBlur(),
            # tr.Normalize(),
            tr.Normalize(mean=(0.2382, 0.2741, 0.3068),
                         std=(0.1586, 0.1593, 0.1618)),
            tr.ToTensor(),
        ])

        return composed_transforms(sample)
示例#10
0
    def transform_tr(self, sample):
        composed_transforms = transforms.Compose([
            tr.RandomHorizontalFlip(),
            tr.RandomVerticalFlip(),
            tr.RandomRotate(180),
            tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
            tr.RandomGaussianBlur(),
            # tr.Normalize(),
            tr.Normalize(mean=(0.1420, 0.2116, 0.2823),
                         std=(0.0899, 0.1083, 0.1310)),
            tr.ToTensor(),
        ])

        return composed_transforms(sample)
示例#11
0
    def transform_tr(self, sample):
        composed_transforms = transforms.Compose([
            #tr.FixScaleCrop(400),
            tr.RandomHorizontalFlip(),
            tr.RandomVerticalFlip(),
            tr.RandomRotate(180),
            tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
            tr.RandomGaussianBlur(),
            tr.Normalize(mean=self.mean_std[0], std=self.mean_std[1]),
            tr.ToTensor(),
        ])

        #print(self.mean_std)
        return composed_transforms(sample)
示例#12
0
    def transform_tr(self, sample):
        composed_transforms = transforms.Compose([
            tr.RandomHorizontalFlip(),
            tr.RandomVerticalFlip(),
            tr.RandomRotate(180),
            tr.RandomScaleCrop(base_size=400, crop_size=400, fill=0),
            tr.RandomGaussianBlur(),
            # tr.Normalize(),
            tr.Normalize(mean=(0.3441, 0.3809, 0.4014),
                         std=(0.1883, 0.2039, 0.2119)),
            tr.ToTensor(),
        ])

        return composed_transforms(sample)