INNER CODE UNIT · Python

tuple_with_path

aangelopoulos/conformal-prediction · generation-scripts/generate-imagenet.py:24

        tuple_with_path = (original_tuple + (path,))
        return tuple_with_path

if __name__ == "__main__":
    with torch.no_grad():
        # Transform as in https://github.com/pytorch/examples/blob/42e5b996718797e45c46a25c55b031e6768f8440/imagenet/main.py#L92
        transform = torchvision.transforms.Compose([
                        torchvision.transforms.Resize(256),
                        torchvision.transforms.CenterCrop(224),
                        torchvision.transforms.ToTensor(),
                        torchvision.transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                                         std= [0.229, 0.224, 0.225])
                    ])

        # Get the Imagenet dataset
        imagenet_dataset = ImageFolderWithPaths('~/data/ilsvrc/val', transform)

        # Initialize loaders

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…