Search code examples
pythontensorflowkeras

Unable to (manually) load cifar10 dataset


First, I tried to load using:

(X_train, y_train), (X_test, y_test) = datasets.cifar10.load_data()

But it gave an error:

Exception: URL fetch failure on https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1125)

So I manually downloaded the dataset and put it in C:\Users\SAHAN\.keras\datasets and renamed it to cifar-10-batches-py.tar.gz.

But then it gives an error:

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\SAHAN\\.keras\\datasets\\cifar-10-batches-py.tar.gz'

How can I load this dataset?


Solution

  • I was having a similar CERTIFICATE_VERIFY_FAILED error downloading CIFAR-10. Putting this in my python file worked:

    import ssl
    ssl._create_default_https_context = ssl._create_unverified_context
    

    Reference: https://programmerah.com/python-error-certificate-verify-failed-certificate-has-expired-40374/