python加载文件数据并画图_tensorflow mnist 数据加载实现并画图效果

关于 TensorFlow

TensorFlow™ 是一个采用数据流图(data flow graphs),用于数值计算的开源软件库。节点(Nodes)在图中表示数学操作,图中的线(edges)则表示在节点间相互联系的多维数据数组,即张量(tensor)。它灵活的架构让你可以在多种平台上展开计算,例如台式计算机中的一个或多个CPU(或GPU),服务器,移动设备等等。TensorFlow 最初由Google大脑小组(隶属于Google机器智能研究机构)的研究员和工程师们开发出来,用于机器学习和深度神经网络方面的研究,但这个系统的通用性使其也可广泛用于其他计算领域。

Tensorflow是谷歌公司在2015年9月开源的一个深度学习框架。

正文开始:

直接看代码:

%matplotlib

from tensorflow.examples.tutorials.mnist import input_data

import matplotlib.pyplot as plt

mnist = input_data.read_data_sets('MNIST_data', one_hot=True)

print('Training data size: ', mnist.train.num_examples)

print('Validation data size: ', mnist.validation.num_examples)

print('Test data size: ', mnist.test.num_examples)

img0 = mnist.train.images[0].reshape(28,28)

img1 = mnist.train.images[1].reshape(28,28)

img2 = mnist.train.images[2].reshape(28,28)

img3 = mnist.train.images[3].reshape(28,28)

fig = plt.figure(figsize=(10,10))

ax0 = fig.add_subplot(221)

ax1 = fig.add_subplot(222)

ax2 = fig.add_subplot(223)

ax3 = fig.add_subplot(224)

ax0.imshow(img0)

ax1.imshow(img1)

ax2.imshow(img2)

ax3.imshow(img3)

fig.show()

画图结果:

总结

以上所述是小编给大家介绍的tensorflow mnist 数据加载实现并画图效果,希望对大家有所帮助!

本文标题: tensorflow mnist 数据加载实现并画图效果

本文地址: http://www.cppcns.com/jiaoben/python/299585.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值