当前位置:网站首页>在Tensorflow2中使用mnist_784数据集进行手写数字识别
在Tensorflow2中使用mnist_784数据集进行手写数字识别
2022-07-02 17:14:00 【GaoZhenwen2】
import tensorflow._api.v2.compat.v1 as tf
tf.disable_v2_behavior
tf.compat.v1.disable_eager_execution()
import numpy as np
#声明使用TensorFlow1版本
from scipy.io import loadmat
mnist = loadmat('G:/pythonProject/MachineLearning/2分类/mnist-original.mat')#把mnist_784数据集单独下载下来,然后用loadmat读取
X = mnist['data'].T#这个一定要转置一下,因为这里面的行列是反的!!!!!
y = mnist['label'].T.flatten()#将数据展开
y= y.astype(np.uint8)#将格式变为uint8
#然后使用pandas将标签y进行热编码,最后将数据转换成为ndarray格式
import pandas as pd
y_pd = pd.Series(y)
y_oneHot = pd.get_dummies(y_pd)
y = np.array(y_oneHot.values)
#好了X,y现在都可以用来训练了边栏推荐
- Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
- Matlab中弧度转角度、角度转弧度
- NM02-独立于总线协议的NM模块调用序列图及代码解释
- Concepts and differences of PR curve and ROC curve
- C语言中函数参数传递的三种方式
- Aptos tutorial - participate in the official incentive testing network (ait2 incentive testing network)
- Leetcode interview question 16.11 Diving board
- How to write controller layer code gracefully?
- 一款简约PHP个人发卡程序V4.0版本
- 昨天阿里学长写了一个责任链模式,竟然出现了无数个bug
猜你喜欢

Wechat nucleic acid detection appointment applet system graduation design (2) applet function

Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore

Night God simulator +fiddler packet capture test app

鸿蒙第四次学习

QT official example: QT quick controls - Gallery

Leetcode interview question 17.01 Addition without plus sign

Wechat applet video sharing platform system graduation design completion (7) Interim inspection report

exness深度好文:动性系列-黄金流动性实例分析(五)

Leetcode(81)——搜索旋转排序数组 II
![Unity learning shader notes [82] black and white processing of enhanced single channel color rendering](/img/db/d745a434e76511742d1264706b5d9a.png)
Unity learning shader notes [82] black and white processing of enhanced single channel color rendering
随机推荐
Export Excel files using npoi
Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用
What is cloud primordial? This time, I can finally understand!
QT official example: QT quick controls - Gallery
Paddlepaddle 28 build an automatic coder based on convolution
Wechat applet video sharing platform system graduation design completion (5) assignment
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations
Leetcode (154) -- find the minimum value II in the rotation sort array
在支付宝账户上买基金安全吗
NM01-独立于总线协议的NM模块功能概述与API定义
阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了
链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
问题包含哪些环节
CDN acceleration and breaking J anti-theft chain function
Leetcode 面试题 16.11. 跳水板
UE4 draw a circle with spline
Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
Redis(6)----对象与数据结构
Web实时通信技术之Websocket
cJSON 使用详解