Pytorch ImageNet数据集

2024-04-27 05:21:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法从他们的官方网站下载原始ImageNet数据集。然而,我发现Pytork将ImageNet作为其火炬视觉数据集之一

问题1。这是原始的ImageNet数据集吗

问题2。如何像在Cifar-10中那样获取数据集的类

classes = [‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’]

Tags: 数据视觉catclasses火炬imagenetdogcifar
1条回答
网友
1楼 · 发布于 2024-04-27 05:21:54

torchvision.datasets.ImageNet只是一个允许您使用ImageNet数据集的类。您必须自己下载数据集(例如,从http://image-net.org/download-images)并将其路径作为root参数传递给ImageNet类对象

请注意,通过传递标志download=True直接下载它的选项已不再可行:

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

如果您只需要获得类名和相应的索引,而不需要下载整个数据集(例如,如果您使用的是预训练模型,并且希望将预测映射到标签),那么您可以从herethis下载它们

相关问题 更多 >