Reputation:
I used this line of code to load the mnist dataset and I got it from tensorflow documentation.
(trainX, trainY), (testX, testY) = load_data(path='mnist.npz')
But when I executed the file I got an error with certificate
The error I got
Traceback (most recent call last):
File "mnist_degit.py", line 18, in <module>
(trainX, trainY), (testX, testY) = load_data(path='mnist.npz')
File "/Users/muongkimhong/Desktop/ComputerVision_project/DigitRecognize/digit_recognize_env/lib/python3.7/site-packages/tensorflow/python/keras/datasets/mnist.py", line 62, in load_data
'731c5ac602752760c8e48fbffcf8c3b850d9dc2a2aedcf2cc48468fc17b673d1')
File "/Users/muongkimhong/Desktop/ComputerVision_project/DigitRecognize/digit_recognize_env/lib/python3.7/site-packages/tensorflow/python/keras/utils/data_utils.py", line 267, in get_file
raise Exception(error_msg.format(origin, e.errno, e.reason))
Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)
Can somebody help please?
Upvotes: 0
Views: 2909
Reputation: 3457
Maybe you could try this:
import tensorflow as tf
(trainX, trainY), (testX, testY) = tf.keras.datasets.mnist.load_data()
Upvotes: 3
Reputation: 71
You could try this:
import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data(path='mnist.npz')
Or
import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.compat.v1.keras.datasets.mnist.load_data()
Upvotes: 0