美文网首页嵌牛IT观察
手写识别--显示程序

手写识别--显示程序

作者: 陶_306c | 来源:发表于2019-12-02 19:45 被阅读0次

陶涛

学号:19131213373

【嵌牛导读】在网上可以找到很多手写识别的程序,给大家分享一个在Mac上的pycharm里的程序.其中涉及到的库需要自己配置。

【嵌牛鼻子】Mac, pycharm, python.

【嵌牛正文】

from tensorflow.examples.tutorials.mnist import input_data #将mnist数据集下载到自己新建的文件夹中
import numpy as np
from matplotlib import pyplot as plt
# 第一次运行会自动下载到代码所在的路径下

mnist = input_data.read_data_sets('/Users/taotao/Desktop/mnist手写数字识别', one_hot=True)#将mnist数据集下载到自己新建的文件夹中
# location 是保存的文件夹的名称

# 打印 mnist 的一些信息

#from tensorflow.examples.tutorials.mnist import input_data
#mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

print("type of 'mnist is %s'" % (type(mnist)))
print("number of train data is %d" % mnist.train.num_examples)
print("number of test data is %d" % mnist.test.num_examples)

# 将所有的数据加载为这样的四个数组 方便之后的使用
trainimg = mnist.train.images
trainlabel = mnist.train.labels
testimg = mnist.test.images
testlabel = mnist.test.labels

print("Type of training is %s" % (type(trainimg)))
print("Type of trainlabel is %s" % (type(trainlabel)))
print("Type of testing is %s" % (type(testimg)))
print("Type of testing is %s" % (type(testlabel)))

# 接上面的代码

nsmaple = 5
randidx = np.random.randint(trainimg.shape[0], size=nsmaple)

for i in randidx:
    curr_img = np.reshape(trainimg[i,:], (28, 28))  # 数据中保存的是 1*784 先reshape 成 28*28
    curr_label = np.argmax(trainlabel[i, :])
    plt.matshow(curr_img, cmap=plt.get_cmap('gray'))
    plt.show()

相关文章

  • 手写识别--显示程序

    陶涛 学号:19131213373 【嵌牛导读】在网上可以找到很多手写识别的程序,给大家分享一个在Mac上的pyc...

  • 开发用网址

    数学公式手写板识别:http://webdemo.myscript.com/index.html 数学公式识别显示...

  • 脱机手写识别技术的实际应用

    手写识别技术分为两种,一种是联机手写识别技术,另一种就是脱机手写识别技术。脱机手写识别技术是目前文字识别领域的难题...

  • 机器学习

    机器学习应用:数据挖掘、垃圾邮件识别、自然语言处理、手写数字识别、图像识别等。 机器学习的定义:计算机程序从经验E...

  • 分类算法-支持向量机分类器

    前言 此程序基于手写体数码图像识别实验 支持向量机(svm)模型实现分类任务。 本程序可以流畅运行于Python3...

  • 手写识别--准确度程序

    陶涛 学号:19131213373 【嵌牛导读】在网上可以找到很多手写识别的程序,给大家分享一个在Mac上的pyc...

  • MNist手写数字进行识别

    MNist手写数字进行识别

  • Pytorch实战(一)——MNIST手写数字识别

    MNIST手写数字识别项目因为数据量小、识别任务简单而成为图像识别入门的第一课,MNIST手写数字识别项目有如下特...

  • OpenCV+Python识别车牌和字符分割

    前面已经基于MNIST识别手写字体(基于MNIST数据集实现手写数字识别),接着本篇文章主要基于python语言和...

  • 神经网络实现Mnist手写数字识别

    1.Mnist手写数字识别介绍 Mnist手写数字识别是Kaggle上一个很经典的机器学习数据集,里边包括...

网友评论

    本文标题:手写识别--显示程序

    本文链接:https://www.haomeiwen.com/subject/phnfgctx.html