transform = 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)),
])

# Initialize CNN
K = 500  # total number of exemplars
icarl = iCaRLNet(2048, 3)
icarl.cuda()

for s in range(0, total_classes, num_classes):
    # Load Datasets
    print("Loading training examples for classes", range(s, s + num_classes))
    #     train_set = iCIFAR10(root='./data',
    #                          train=True,
    #                          classes=range(s,s+num_classes),
    #                          download=True,
    #                          transform=transform_test)
    train_set = mnist(train=True,
                      classes=range(s, s + num_classes),
                      transform=transform_test)
    train_loader = torch.utils.data.DataLoader(train_set,
                                               batch_size=128,
Beispiel #2
0
transform = 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)),
])

# Initialize CNN
K = 2000  # total number of exemplars
icarl = iCaRLNet(2048, 10)
icarl.cuda()

for s in range(0, total_classes, num_classes):
    # Load Datasets
    print("Loading training examples for classes", range(s, s + num_classes))
    train_set = iCIFAR100(root='./data',
                          train=True,
                          classes=range(s, s + num_classes),
                          download=True,
                          transform=transform_test)
    train_loader = torch.utils.data.DataLoader(train_set,
                                               batch_size=64,
                                               shuffle=True,
                                               num_workers=0)