reg*_*ald 5 python dataset imagenet pytorch
我无法从他们的官方网站下载原始 ImageNet 数据集。但是,我发现 pytorch 将 ImageNet 作为其火炬视觉数据集之一。
一季度。那是原始的 ImageNet 数据集吗?
Q2。我如何像在 Cifar-10 中那样获取数据集的类
classes = [‘airplane’, ‘automobile’, ‘bird’, ‘cat’, ‘deer’, ‘dog’, ‘frog’, ‘horse’, ‘ship’, ‘truck’]
Run Code Online (Sandbox Code Playgroud)
这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)
Run Code Online (Sandbox Code Playgroud)
(来源)
如果您只需要在不下载整个数据集的情况下获取类名和相应的索引(例如,如果您使用的是预训练模型并希望将预测映射到标签),那么您可以从这里或从这个github gist下载它们.