下载MNIST时,我无法获取“processed”文件夹

问题描述 投票:0回答:3

我正在关注这里的教程https://www.youtube.com/watch?v=IQpP_cH8rrA

我遵循了所有初始步骤(除了我在 VS 中而不是在 Colab 中),但我很快就停止了,因为运行时:

torchvision.datasets.MNIST('./', download=True)

我只得到原始文件夹,而不是处理后的文件夹(应包含training.pt和test.pt)。

有人可以帮忙吗?

我正在 python 3.8.10、torch 版本 1.10.1、torchvision 0.11.2 上运行

PS:我在这里发现了同样的问题https://github.com/pytorch/vision/issues/4685

我真的应该将 torchvision 降级到 0.9.1 才能拥有这两个文件夹吗?

如果是,我怎样才能从cmd降级torchvision,而不卸载torch并重新安装所有内容?

pytorch mnist torchvision pytorch-dataloader
3个回答
0
投票

我找到了这个解决办法,从张量流下载数据,然后只需切换数据类型,这样您就可以再次按照教程进行操作。希望这有帮助

import tensorflow as tf
import torch
import numpy as np


mnist = tf.keras.datasets.mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()

print(x_train.shape)
images = torch.from_numpy(x_train)
ground_truth = torch.from_numpy(y_train)
print(images.shape)
print(ground_truth.shape)

`

这适用于我的笔记本,希望它也适用于您


0
投票

我不确定这个答案是否会对任何人有帮助,但这是我的解决方案(经过在互联网上的大量尝试和搜索后,我不太有经验): (我用的是anaconda提示)

  1. 我为 python 3.6 创建了一个名为“test”的虚拟环境: conda 创建-n 测试 python=3.6 激活测试
  2. 我在上面安装了推荐的torchvision版本: pip install torchvision==0.9.1
  3. 我在虚拟环境中运行我的程序: python yourprogram.py

我确信这不是最好的解决方案,但它对我有用,而且非常简单,因为它只是 anaconda 提示符中的几行。


0
投票

您可以从此链接

下载数据集图像
© www.soinside.com 2019 - 2024. All rights reserved.