【问题标题】:Pytorch ImageNet datasetPytorch ImageNet 数据集
【发布时间】:2020-06-21 18:31:50
【问题描述】:

我无法从他们的官方网站下载原始 ImageNet 数据集。但是,我发现 pytorch 将 ImageNet 作为其 Torch 视觉数据集之一。

第一季度。那是原始的 ImageNet 数据集吗?

第二季度。如何像在 Cifar-10 中一样获取数据集的类

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

【问题讨论】:

    标签: python dataset pytorch imagenet


    【解决方案1】:

    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)

    如果您只需要获取类名和相应的索引而不下载整个数据集(例如,如果您使用预训练模型并将预测映射到标签),那么您可以下载它们,例如来自here 或来自this github gist。

    【讨论】:

    猜你喜欢
    • 2020-09-26
    • 2020-12-29
    • 1970-01-01
    • 2017-07-30
    • 2021-07-01
    • 1970-01-01
    • 2021-07-15
    • 2022-07-18
    • 2020-09-28
    相关资源
    最近更新 更多