码迷,mamicode.com
首页 > 其他好文 > 详细

Tensorflow_MNIST

时间:2018-08-18 21:14:03      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:rop   flatten   soft   note   ipy   seq   ola   test   notebook   

MNIST dataset

1.Summarization
技术分享图片
2.loading

import tensorflow as tf
mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(),
  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation=tf.nn.softmax)
])
model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)

Run_IN_A_CO_NOTEBOOK

the Result

技术分享图片

KEYBOARDS

Tensorflow_MNIST

标签:rop   flatten   soft   note   ipy   seq   ola   test   notebook   

原文地址:https://www.cnblogs.com/hugeng007/p/9498541.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!