栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

MNIST 手写数字识别调用

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

MNIST 手写数字识别调用

应用于Tensorflow2.7的,具体结果如图:

 数字图片显示:

 具体的代码:

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
%matplotlib inline 

print("Tensorflow version:", tf.__version__)

 文件下载的代码:

mnist =tf.keras.datasets.mnist
(train_images,train_labels),(test_images,test_labels)= mnist.load_data()
print("Train image shape:",train_images.shape,"Train label shape:",train_labels.shape)
print("Test image shape:",test_images.shape,"Test label shape:",test_labels.shape)
print("image data:",train_images[1])
print("train labels:",train_labels[1])

数字图片函数定义及实现代码:

def plot_image(image):
    plt.imshow(image.reshape(28,28),cmap='binary')
    plt.show()

选择train_image[]的可以正常显示图片。

imshow 的图片格式变换信息可以参考:Matplotlib imshow()函数_叫我SKY的博客-CSDN博客_plt.imshow()https://blog.csdn.net/qq_21763381/article/details/100169288

 (1条消息) 关于MNIST手写数字识别的几种实现方式_Lzjusc2017的博客-CSDN博客_手写数字识别mnisthttps://blog.csdn.net/qq_40318498/article/details/103071141

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/675327.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号