Pytorch ImageNet dataset
Asked Answered
L

1

11

I am unable to download the original ImageNet dataset from their official website. However, I found out that pytorch has ImageNet as one of it’s torch vision datasets.

Q1. Is that the original ImageNet dataset?

Q2. How do I get the classes for the dataset like it’s being done in Cifar-10

classes = [‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’]
Lyckman answered 9/3, 2020 at 20:21 Comment(0)
S
17

The torchvision.datasets.ImageNet is just a class which allows you to work with the ImageNet dataset. You have to download the dataset yourself (e.g. from http://image-net.org/download-images) and pass the path to it as the root argument to the ImageNet class object.

Note that the option to download it directly by passing the flag download=True is no longer possible:

if download is True:
    msg = ("The dataset is no longer publicly accessible. You need to "
           "download the archives externally and place them in the root "
           "directory.")
    raise RuntimeError(msg)
elif download is False:
    msg = ("The use of the download flag is deprecated, since the dataset "
           "is no longer publicly accessible.")
    warnings.warn(msg, RuntimeWarning)

(source)

If you just need to get the class names and the corresponding indices without downloading the whole dataset (e.g. if you are using a pretrained model and want to map the predictions to labels), then you can download them e.g. from here or from this github gist.

Selfdeprecating answered 10/3, 2020 at 6:52 Comment(6)
Thanks alot. Best regards!Lyckman
It seems that the link image-net.org/download-images doesn't work: it offers to download the full dataset from image-net.org/archive/stanford/fall11_whole.tar, which yields a 404 error.Vere
@GeoffreyNegiar did you find a solution?Nardoo
The link image-net.org/download-images does work -- it has actually been recently updated with a version where all faces in the dataset are blurred.Vere
A not-very-relevant question. Is there any version of Tiny ImageNet in original size of ImageNet? 256*256 instead of 64*64.Screenplay
Data is available here kaggle.com/competitions/imagenet-object-localization-challenge/… now, but it is reorganized, see also discuss.pytorch.org/t/…Relational

© 2022 - 2024 — McMap. All rights reserved.