def evaluate_dataset(net, path): testset = ImageFolder(root=path, transform=Compose([ Resize((32, 32)), ToTensor(), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)
def evaluate_svhn(net): testset = SVHN(root='data', split="test", download=True, transform=Compose([ ToTensor(), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)
def evaluate_cifar10(net): testset = CIFAR10(root='data', train=False, download=True, transform=Compose([ ToTensor(), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset))
def evaluate_mnist(net): testset = MNIST(root='data', train=False, download=True, transform=Compose([ Resize((32, 32)), Grayscale(num_output_channels=3), ToTensor(), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)
def evaluate_svhn(net): testset = SVHN(root='data', split="train", download=True, transform=Compose([ ToTensor(), Normalize((0.43767047, 0.44375867, 0.47279018), (0.19798356, 0.20096427, 0.19697163)), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)
def evaluate_cifar10(net): testset = CIFAR10(root='data', train=True, download=True, transform=Compose([ ToTensor(), Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)
def evaluate_dataset(net, path): testset = ImageFolder( root=path, transform=Compose([ Resize((32, 32)), ToTensor(), Normalize((0.1307, 0.1307, 0.1307), (0.3081, 0.3081, 0.3081)), # Normalize((0.43767047, 0.44375867, 0.47279018), (0.19798356, 0.20096427, 0.19697163)), # Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010)), ])) testloader = DataLoader(testset, batch_size=64, shuffle=False, num_workers=2) evaluate_network_with_classes(net, testloader, len(testset), OUT_FEATURES)