【TensorFlow】线性加权法-mnist手写体识别实践 笔记

〇、前情提要

在b站跟着up主 白手起家的百万富翁 学mnist手写体识别实践。
参考:

  1. 【mnist手写体识别实践】想知道手写体识别如何做吗?跟美女算法专家一起了解mnist数据集 并用python实践手写体识别吧
    https://www.bilibili.com/video/BV1YJ41137jy/?spm_id_from=333.788.videocard.0
  2. minist数据集 - THE MNIST DATABASE of handwritten digits
    http://yann.lecun.com/exdb/mnist/
  3. 我的笔记- 【TensorFlow】mac下出现from tensorflow.examples.tutorial.mnist import input_data无法导入
    https://blog.csdn.net/weixin_43210113/article/details/107671454
  4. 我的笔记-【TensorFlow】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
    https://blog.csdn.net/weixin_43210113/article/details/107673559
  5. AttributeError: module ‘tensorflow’ has no attribute 'placeholder’等问题的解决
    https://blog.csdn.net/flowingfog/article/details/93597697?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

一、写在前面

up的简介

之前一直讲算法理论,本期视频带大家用python动手实践mnist数据集,简单了解mnist数据集并进行手写体识别实践,希望可以让大家从最简单的入门,慢慢进入人工智能领域,我的初衷就是希望能帮助想进入人工智能领域的朋友快速了解AI,我所有视频的ppt都会发在专栏里,如果大家喜欢,请关注我,并点赞转发弹幕评论投币哦~ 如果非常喜欢我的话,请给我充电哦~我会一直更新的,你们的支持是我最大的动力

其他

目前做机器学习python,深度学习TensorFlow、Keras,用的softmax函数,一层神经网络的形式。

准备工作

下载

  • train-images-idx3-ubyte.gz: training set images (9912422 bytes)
  • train-labels-idx1-ubyte.gz: training set labels (28881 bytes)
  • t10k-images-idx3-ubyte.gz: test set images (1648877 bytes)
  • t10k-labels-idx1-ubyte.gz: test set labels (4542 bytes)

二、读入数据集并查看格式

一些提示

如果无法导入from tensorflow.examples.tutorials.mnist import input_data,可以看我写的笔记:

我的笔记- 【TensorFlow】mac下出现from tensorflow.examples.tutorial.mnist import input_data无法导入
https://blog.csdn.net/weixin_43210113/article/details/107671454

one_hot
one_hot是分类问题必用的一种手段
数字一共10类,就把
0转成(1,0,0,0,0,0,0,0,0,0),
1转成(0,1,0,0,0,0,0,0,0,0),
2转成(0,0,1,0,0,0,0,0,0,0),

这样可以匹配最后softmax层维数

下载数据集
# 如果tensorflow版本为1用第一种 版本为2用第二种
import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# 使用mnist数据集,要引用读取方式
from tensorflow.examples.tutorials.mnist import input_data
# from tensorflow.contrib.learn.python.learn.datasets.mnist import read_da
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值