日月光华深度学习课程资源详解
·
最近,对深度学习感兴趣,报了日月光华深度学习课程,所以给大家分享全部的代码、PPT、数据集资源:下载链接
以下是fashion mnist数据集的识别分类代码:
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
(train_image,train_lable),(test_image,test_label)= tf.keras.datasets.fashion_mnist.load_data()
print(train_image.shape)
print(test_image.shape)
#归一化
train_image = train_image/255
test_image = test_image/255
model = tf.keras.Sequential()
#不能把二维数据进行dense运算(28,28)
#28*28
model.add(tf.keras.layers.Flatten(input_shape=(28,28)))
#128,不能太大,会过拟合
model.add(tf.keras.layers.Dense(128,activation='relu'))
#概率输出,分10类
model.add(tf.keras.layers.Dense(10,activation='softmax'))
model.compile(optimizer = 'adam',loss = 'sparse_categorical_crossentropy',
metrics=['acc'])
history = model.fit(train_image,train_lable,epochs=10)
history.history.keys()
plt.plot(history.epoch,history.history.get("loss"))
plt.plot(history.epoch,history.history.get("acc"))
plt.show()
model.evaluate(test_image,test_label)
希望大家在深度学习的路上越走越远!
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐


所有评论(0)