Я загружал "keras.datasets.fashion_mnist", а затем соединение inte rnet было потеряно. когда я снова запускаю программу, у меня появляется эта ошибка
C:\Users\Shady\.conda\envs\TFnEW\pythonw.exe C:/Users/Shady/PycharmProjects/CNN_TensorF/CNNTF.py
Traceback (most recent call last):
File "C:/Users/Shady/PycharmProjects/CNN_TensorF/CNNTF.py", line 8, in <module>
(train_images, train_labels), (test_images, test_labels) = data.load_data()
File "C:\Users\Shady\.conda\envs\TFnEW\lib\site-packages\tensorflow\python\keras\datasets\fashion_mnist.py", line 59, in load_data
imgpath.read(), np.uint8, offset=16).reshape(len(y_train), 28, 28)
File "C:\Users\Shady\.conda\envs\TFnEW\lib\gzip.py", line 274, in read
return self._buffer.read(size)
File "C:\Users\Shady\.conda\envs\TFnEW\lib\gzip.py", line 480, in read
raise EOFError("Compressed file ended before the "
EOFError: Compressed file ended before the end-of-stream marker was reached
Process finished with exit code 1***
_____________________________________________________________________________
и вот моя программа
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
data = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = data.load_data()
class_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat',
'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
train_images = train_images/255.0
test_images = test_images/255.0
model = keras.Sequential([
keras.layers.Flatten(input_shape=(28,28)),
keras.layers.Dense(128, activation="relu"),
keras.layers.Dense(10, activation="softmax")
])
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
model.fit(train_images, train_labels, epochs=5)
test_loss, test_acc = model.evaluate(test_images, test_labels)
print('\nTest accuracy:', test_acc)***