问题描述
在Jupyter Notebook中加载Mnist数据集时遇到了一些错误,并且我正在使用Windows。
我的python版本是3.7,我使用Microsoft Visual Studio安装。 我已经安装了蟒蛇。
我试图运行此代码:
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
mnist_dataset,mnist_info = tfds.load(name='mnist',with_info=True,as_supervised=True)
这是我收到的错误消息:
SSLError: Failed to construct dataset mnistHTTPSConnectionPool(host='storage.googleapis.com',port=443): Max retries exceeded with url: /tfds-data/?prefix=dataset_info/mnist/3.0.1/ (Caused by SSLError(SSLCertVerificationError(1,'[SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed: unable to get local issuer certificate (_ssl.c:1076)')))
请帮助,谢谢!
解决方法
此android:exported="false"
documentation 链接到Github存储库,该存储库提供了获取load_data
文件的网址。
https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
将其放入任何本地目录:
mnist.npz
每个文档mnist是“ Numpy数组的元组:(x_train,y_train),(x_test,y_test)” 因此您可以按以下方式阅读它:
path = '/your local directory path/'
然后开始在模型中使用它。