代码如下
import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt 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 model = keras.models.Sequential([ keras.layers.Flatten(), keras.layers.Dense(128,activation='relu'), keras.layers.Dense(10,activation="softmax") ]) model.compile(optimizer='adam',loss=keras.losses.SparseCategoricalCrossentropy(from_logits=False),metrics=['sparse_categorical_accuracy']) model.fit(x_train,y_train,batch_size=32,epochs=5,validation_data=(x_test,y_test),validation_freq=1) model.summary()
刚写完上一篇文章有点小累,水一篇哈,这篇的代码在上一篇都有讲解,不懂的回去瞅瞅,复习一下,俺溜了,下篇好好写,下篇见嗷小伙伴们!0^0
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)