用 Keras 实现神经网络

Implementing Neural Nets with Keras

我正在尝试在我的计算机中实现此 code,我遇到的问题是 运行 以下代码出错:

fashion_mnist = keras.datasets.fashion_mnist
(X_train_full, y_train_full), (X_test, y_test) = (fashion_mnist.load_data())
X_valid, X_train = X_train_full[:5000], X_train_full[5000:]
y_valid, y_train = y_train_full[:5000], y_train_full[5000:]

错误:

~\Anaconda3\lib\site-packages\tensorflow_core\python\keras\utils\data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
    251         urlretrieve(origin, fpath, dl_progress)
    252       except HTTPError as e:
--> 253         raise Exception(error_msg.format(origin, e.code, e.msg))
    254       except URLError as e:
    255         raise Exception(error_msg.format(origin, e.errno, e.reason))

Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz: 403 -- Forbidden

但如果我尝试单独下载数据,它不会给出禁止错误,我尝试加载数据而不从 Google 但又出现了另一个错误

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-68fe7d0ac27a> in <module>
      1 fashion_mnist = keras.datasets.fashion_mnist
----> 2 (X_train_full, y_train_full), (X_test, y_test) = (fashion_mnist)
      3 X_valid, X_train = X_train_full[:5000], X_train_full[5000:]
      4 y_valid, y_train = y_train_full[:5000], y_train_full[5000:]

TypeError: cannot unpack non-iterable module object

最后决定不用load_data()的方法还是一样的错误,请问有什么方法可以解包准备train-labels-idx1-ubyte[=30的数据=] 不用上面的方法?

PS:我尝试使用 VPN,但仍然响应 Forbidden

如果下载正确,需要指定路径。

您是否尝试过 (X_train_full, y_train_full), (X_test, y_test) = fashion_mnist.load_data (path="%yourLocalPath%") 所记录的 Here ? tensorflow docs

如果不是,您遇到的第一个错误是因为您居住在禁止使用 TensorFlow 的地方,只需使用 VPN。