【tf.keras】ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record m

問題描述

tf.keras 在加載 cifar10 數據時報錯,ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1977)python

import tensorflow as tf

cifar10 = tf.keras.datasets.cifar10
(x_train, y_train), (x_test, y_test) = cifar10.load_data()

解決方案

第一步:從網址 https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz 手動下載數據;
第二步:將數據集 cifar-10-python.tar.gz 重命名爲 cifar-10-batches-py.tar.gz,而後將數據集放在 ~/.keras/datasets/ 目錄下。(~/.keras/datasets/是啥意思呢,如在 linux 下,能夠是 /home/wuliytTaotao/.keras/datasets,將 wuliytTaotao 改爲本身的用戶名便可)linux

References

使用keras的cifar10.load_data()老是會自動下載問題 -- 不愛吃飯的小孩怎麼辦code

相關文章
相關標籤/搜索