以图片形式,序列号+数据标签名字存储mnist图片到本地

# Save mnist test data and check wrong labeled test data at Local

import os 
from torchvision import datasets

path = 'F:\\3.5\\programs\\mnist_test\\'
test = datasets.MNIST("./mnist_data", train=False, download=True)

for i in range(0, len(test)):
    test[i][0].save(os.path.join(path, str(i) + '_label-' + str(test[i][1]) + ".jpg"))

你可能感兴趣的:(mnist数据集查看)