手写数字识别 (tensorflow==2.4.0)

简介: 手写数字识别 (tensorflow==2.4.0)
import tensorflow as tf
from tensorflow import keras
fashion_mnist=keras.datasets.fashion_mnist
(train_images,train_labels),(test_images,test_labels)=fashion_mnist.load_data()
train_images=train_images/255.0
test_images=test_images/255.0
model=keras.Sequential(layers=[
    keras.layers.Flatten(input_shape=(28,28)),
    keras.layers.Dense(128,activation='relu'),
    keras.layers.Dense(10)
])
model.compile(optimizer='adam',
              loss=keras.losses.SparseCategoricalCrossentropy(
                  from_logits=True),
              metrics=['accuracy'])
model.fit(train_images,train_labels,epochs=3,batch_size=64)
#测试
model.evaluate(test_images,test_labels)
predicted_model=keras.Sequential(layers=[model,keras.layers.Softmax()])
predicted=predicted_model.predict(train_images[:10])
print(predicted)

image.png

目录
相关文章
|
4月前
|
机器学习/深度学习 算法 TensorFlow
【Python深度学习】Tensorflow对半环形数据分类、手写数字识别、猫狗识别实战(附源码)
【Python深度学习】Tensorflow对半环形数据分类、手写数字识别、猫狗识别实战(附源码)
57 0
|
TensorFlow 算法框架/工具 计算机视觉
|
机器学习/深度学习 PyTorch 测试技术
|
机器学习/深度学习 存储 算法
100天搞定机器学习|day39 Tensorflow Keras手写数字识别
100天搞定机器学习|day39 Tensorflow Keras手写数字识别
100天搞定机器学习|day39 Tensorflow Keras手写数字识别
|
机器学习/深度学习 TensorFlow 算法框架/工具
TensorFlow MNIST手写数字识别(神经网络最佳实践版)
TensorFlow MNIST手写数字识别(神经网络最佳实践版)
|
机器学习/深度学习 TensorFlow 算法框架/工具
TensorFlow MNIST手写数字识别(神经网络极简版)
TensorFlow MNIST手写数字识别(神经网络极简版)
TensorFlow MNIST手写数字识别(神经网络极简版)
|
机器学习/深度学习 数据可视化 TensorFlow
python-手写数字识别改进+TensorBoard(TensorFlow可视化)
python-手写数字识别改进+TensorBoard(TensorFlow可视化)
145 0
python-手写数字识别改进+TensorBoard(TensorFlow可视化)
|
机器学习/深度学习 人工智能 并行计算
HaaS AI之手写数字识别快速实践,在VSCode中搭建TensorFlow 2.0简单神经网络
本文将介绍如何在VSCode里面搭建TensorFlow的开发环境,并跑一个简单的神经网络来进行手写数据的识别。
HaaS AI之手写数字识别快速实践,在VSCode中搭建TensorFlow 2.0简单神经网络
|
机器学习/深度学习 测试技术 TensorFlow
(Tensorflow)手把手CNN入门:手写数字识别
手把手带你实战——《CNN入门:手写数字识别》!
4683 0
|
机器学习/深度学习 TensorFlow 算法框架/工具

热门文章

最新文章