Doarchive

Keras Mnist dataset 을 로드 할 수 없을 때 (Mac) 본문

Computer Vision/Deep learning

Keras Mnist dataset 을 로드 할 수 없을 때 (Mac)

오순발닦개 2021. 4. 9. 14:30

 

 

 

mnist = tf.keras.datasets.mnist

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

 

해당 코드에서

 

Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
Traceback (most recent call last):

 

이런 에러가 발생할 경우

 

해당파일에

~/Library/Python/3.7/lib/python/site-packages/tensorflow/python/keras/utils/data_utils.py

 

 

이부분을 추가해 준다 

import requests

requests.packages.urllib3.disable_warnings()

import ssl

 

try:

    _create_unverified_https_context = ssl._create_unverified_context

except AttributeError:

   # Legacy Python that doesn't verify HTTPS certificates by default

   pass

else:

    # Handle target environment that doesn't support HTTPS verification

    ssl._create_default_https_context = _create_unverified_https_context

 

 

출처: github.com/tensorflow/tensorflow/issues/33285 

728x90