当前位置:网站首页>在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现在都可以用来训练了
边栏推荐
- Radian to angle, angle to radian in MATLAB
- sql训练2
- Summary of fun free GM games
- Détends - toi encore! Ces nouveaux étudiants peuvent s'installer directement à Shanghai
- Web实时通信技术之Websocket
- Qt官方示例:Qt Quick Controls - Gallery
- Detailed explanation of cjson usage
- A simple PHP personal card issuing program v4.0
- Installation tutorial and simple call of Matplotlib
- NM01-独立于总线协议的NM模块功能概述与API定义
猜你喜欢
Wechat applet video sharing platform system graduation design completion (7) Interim inspection report
鸿蒙第四次学习
Simulateur nightGod + application de test de capture de paquets Fiddler
A simple PHP personal card issuing program v4.0
Qt Official examples: Qt Quick Controls - Gallery
Leetcode (81) -- search rotation sort array II
Implementation shadow introduction
Leetcode 面试题 17.04. 消失的数字
Qt官方示例:Qt Quick Controls - Gallery
Chrome officially supports MathML, which is enabled in chromium dev 105 by default
随机推荐
Leetcode interview question 16.15 Abacus wonderful calculation
Wechat applet video sharing platform system graduation design completion (4) opening report
StretchDIBits函数
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations
Troubleshooting ideas that can solve 80% of faults
PR曲线和ROC曲线概念及其区别
RDK simulation experiment
options should NOT have additional properties
Memory mapping of QT
@Component 拿不到dao层
什么是云原生?这回终于能搞明白了!
实施阴影介绍
Typical application of "stack" - expression evaluation (implemented in C language)
300+篇文献!一文详解基于Transformer的多模态学习最新进展
Leetcode 面试题 16.17. 连续数列
如何清理废弃pv和其对应的文件夹
Meta universe chain game system development (logic development) - chain game system development (detailed analysis)
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
Rte11 interrupt decoupling function
Unity learning shader notes [81] simple color adjustment post-processing (brightness, saturation, contrast)