当前位置:网站首页>在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现在都可以用来训练了
边栏推荐
- 27:第三章:开发通行证服务:10:【注册/登录】接口:注册/登录OK后,把用户会话信息(uid,utoken)保存到redis和cookie中;(一个主要的点:设置cookie)
- iptable端口重定向 MASQUERADE[通俗易懂]
- Industrial software lecture - core technology analysis of 3D CAD design software - the second lecture of the Forum
- 如何优雅的写 Controller 层代码?
- 再放寬!這些應届生,可直接落戶上海
- Ue4 dessine un cercle avec une ligne de contour
- Responses of different people in technology companies to bugs | daily anecdotes
- Qt官方示例:Qt Quick Controls - Gallery
- What is cloud primordial? This time, I can finally understand!
- After 22 years in office, the father of PowerShell will leave Microsoft: he was demoted by Microsoft for developing PowerShell
猜你喜欢
Night God simulator +fiddler packet capture test app
ESP32-C3入门教程 问题篇⑩——error: implicit declaration of function ‘esp_blufi_close‘;
UE4 用spline画正圆
Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement
工业软件讲堂-三维CAD设计软件的核心技术解析----讲坛第二次讲座
Wechat applet video sharing platform system graduation design completion (1) development outline
Ue4 dessine un cercle avec une ligne de contour
Wechat applet video sharing platform system graduation design (3) background function
Troubleshooting ideas that can solve 80% of faults
揭秘得物客服IM全链路通信过程
随机推荐
ESP32-C3入门教程 问题篇⑩——error: implicit declaration of function ‘esp_blufi_close‘;
How to write controller layer code gracefully?
Chain game system development (unity3d chain game development details) - chain game development mature technology source code
Leetcode interview question 17.04 Vanishing numbers
Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs
深度神经网络总结
如何清理废弃pv和其对应的文件夹
呆错图床系统源码图片CDN加速与破J防盗链功能
300+ documents! This article explains the latest progress of multimodal learning based on transformer
问题包含哪些环节
阿里三面被面试官狂问Redis,简历上再也不敢写'精通'了
C语言中函数参数传递的三种方式
Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
cJSON 使用详解
RDK simulation experiment
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations
彻底搞懂基于Open3D的点云处理教程!
IPtable port redirection masquerade[easy to understand]
Steamos 3.3 beta release, steam deck Chinese keyboard finally came
Wechat applet video sharing platform system graduation design (3) background function