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)
def transform_tr(self, sample): train_transforms = list() train_transforms.append(tr.Resize(self.cfg.LOAD_SIZE)) train_transforms.append(tr.RandomScale(self.cfg.RANDOM_SCALE_SIZE)) train_transforms.append( tr.RandomCrop(self.cfg.FINE_SIZE, pad_if_needed=True, fill=0)) train_transforms.append(tr.RandomRotate()) train_transforms.append(tr.RandomGaussianBlur()) train_transforms.append(tr.RandomHorizontalFlip()) # if self.cfg.TARGET_MODAL == 'lab': # train_transforms.append(tr.RGB2Lab()) if self.cfg.MULTI_SCALE: for item in self.cfg.MULTI_TARGETS: self.ms_targets.append(item) train_transforms.append( tr.MultiScale(size=self.cfg.FINE_SIZE, scale_times=self.cfg.MULTI_SCALE_NUM, ms_targets=self.ms_targets)) 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)
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)
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)
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)
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=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)), tr.Normalize(), tr.ToTensor(), ]) return composed_transforms(sample)
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)
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)
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)
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)
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)
def transform_tr(self, sample): train_transforms = list() # train_transforms.append(tr.RandomScale(base_size=self.cfg.LOAD_SIZE, crop_size=self.cfg.FINE_SIZE)) train_transforms.append(tr.RandomScale(self.cfg.RANDOM_SCALE_SIZE)) train_transforms.append(tr.Resize(self.cfg.LOAD_SIZE)) train_transforms.append( tr.RandomCrop(self.cfg.FINE_SIZE, pad_if_needed=True, fill=0)) train_transforms.append(tr.RandomGaussianBlur()) train_transforms.append(tr.RandomHorizontalFlip()) 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)