fashion数据集总共有7万张28*28像素点的灰度图片和标签,涵盖十个分类:T恤、裤子、套头衫、连衣裙、外套、凉鞋、衬衫、运动鞋、包、靴子。
其中6万张用于训练,1万张用于测试。
import tensorflow as tf from tensorflow import keras from matplotlib import pyplot as plt import numpy as np from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense,Dropout fashion = keras.datasets.fashion_mnist (x_train, y_train), (x_test, y_test) = fashion.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0 x_train = x_train.reshape(x_train.shape[0], 28, 28, 1) x_test = x_test.reshape(x_test.shape[0], 28, 28, 1)