transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) transform_test = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ]) trainset = data_providers.CIFAR10(root='data', set_name='train', download=True, transform=transform_train) train_data = torch.utils.data.DataLoader(trainset, batch_size=100, shuffle=True, num_workers=2) valset = data_providers.CIFAR10(root='data', set_name='val', download=True, transform=transform_test) val_data = torch.utils.data.DataLoader(valset, batch_size=100, shuffle=False, num_workers=2)
#trial - no transforms # transform_train = transforms.Compose([ # transforms.RandomCrop(32, padding=4), # transforms.RandomHorizontalFlip(), # transforms.ToTensor(), # transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), # ]) # transform_test = transforms.Compose([ # transforms.ToTensor(), # transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), # ]) trainset = data_providers.CIFAR10(root='CIFAR10_Data/', set_name='train', download=False, transform=transform_train) styled = data_providers.AugmentedCIFAR10(path='CIFAR10_Data/Pickled/', transform=transform_train) concatenated = torch.utils.data.ConcatDataset([trainset, styled]) train_data = torch.utils.data.DataLoader(concatenated, batch_size=128, shuffle=True, num_workers=4) print('Total elements for training:', len(concatenated), len(styled)) print(styled[9][1].dtype) print(trainset[9][1].dtype)