def __init__(self, data_path, **kwargs): ds_kwargs = { 'num_classes': 10, 'mean': ch.tensor([0.5, 0.5, 0.5]), 'std': ch.tensor([0.5, 0.5, 0.5]), 'custom_class': torchvision.datasets.SVHN, 'label_mapping': None, 'transform_train': da.TRAIN_TRANSFORMS_DEFAULT(32), 'transform_test': da.TEST_TRANSFORMS_DEFAULT(32) } super(SVHN, self).__init__('svhn', data_path, **ds_kwargs)
def __init__(self, data_path, **kwargs): """ """ ds_kwargs = { 'num_classes': 10, 'mean': ch.tensor([0.47889522, 0.47227842, 0.43047404]), 'std': ch.tensor([0.24205776, 0.23828046, 0.25874835]), 'custom_class': None, 'label_mapping': None, 'transform_train': da.TRAIN_TRANSFORMS_DEFAULT(32), 'transform_test': da.TEST_TRANSFORMS_DEFAULT(32) } super(CINIC, self).__init__('cinic', data_path, **ds_kwargs)
def __init__(self, data_path='/tmp/', **kwargs): """ """ ds_kwargs = { 'num_classes': 10, 'mean': ch.tensor([0.4914, 0.4822, 0.4465]), 'std': ch.tensor([0.2023, 0.1994, 0.2010]), 'custom_class': datasets.CIFAR10, 'label_mapping': None, 'transform_train': da.TRAIN_TRANSFORMS_DEFAULT(32), 'transform_test': da.TEST_TRANSFORMS_DEFAULT(32) } super(CIFAR, self).__init__('cifar', data_path, **ds_kwargs)
def __init__( self, data_path, corruption_type: str = 'gaussian_noise', severity: int = 1, **kwargs, ): class CustomCIFAR10(CIFAR10): def __init__(self, root, train=True, transform=None, target_transform=None, download=False): VisionDataset.__init__(self, root, transform=transform, target_transform=target_transform) if train: raise NotImplementedError( 'No train dataset for CIFAR-10-C') if download and not os.path.exists(root): raise NotImplementedError( 'Downloading CIFAR-10-C has not been implemented') all_data = np.load( os.path.join(root, f'{corruption_type}.npy')) all_labels = np.load(os.path.join(root, f'labels.npy')) severity_slice = slice( (severity - 1) * 10000, severity * 10000, ) self.data = all_data[severity_slice] self.targets = all_labels[severity_slice] DataSet.__init__( self, 'cifar10c', data_path, num_classes=10, mean=torch.tensor([0.4914, 0.4822, 0.4465]), std=torch.tensor([0.2023, 0.1994, 0.2010]), custom_class=CustomCIFAR10, label_mapping=None, transform_train=data_augmentation.TRAIN_TRANSFORMS_DEFAULT(32), transform_test=data_augmentation.TEST_TRANSFORMS_DEFAULT(32) )