def make_train_transform(self): return transforms.Compose([ pt_util.ToPILImage(), transforms.RandomResizedCrop(self.size, scale=(0.2, 1.0)), transforms.RandomHorizontalFlip(), pt_util.ToTensor(scale=255), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ])
def make_val_transform(self): return transforms.Compose([ pt_util.ToPILImage(), transforms.Resize( (int(self.size[0] / 0.875), int(self.size[1] / 0.875)), interpolation=Image.BILINEAR), transforms.CenterCrop(self.size), pt_util.ToTensor(scale=255), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ])
def make_train_transform(self): return transforms.Compose([ pt_util.ToPILImage(), transforms.RandomResizedCrop(self.size, scale=(0.7, 1.0)), transforms.ColorJitter(0.8, 0.8, 0.8, 0.2), transforms.RandomGrayscale(p=0.2), transforms.RandomHorizontalFlip(), pt_util.ToTensor(scale=255), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), transforms.RandomApply( [util_functions.RandomGaussianBlur(self.size[0] // 10)], p=0.5), ])
def make_train_transform(self): return transforms.Compose([ pt_util.ToPILImage(), transforms.RandomResizedCrop(self.size, scale=(0.2, 1), ratio=(0.7, 1.4), interpolation=Image.BILINEAR), transforms.ColorJitter(0.4, 0.4, 0.4, 0.2), # transforms.RandomApply([transforms.ColorJitter(0.4, 0.4, 0.4, 0.4)], p=0.8), transforms.RandomGrayscale(p=0.2), transforms.RandomHorizontalFlip(), pt_util.ToTensor(scale=255), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ])