许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  TensorFlow在数字识别统计中的应用

TensorFlow在数字识别统计中的应用

阅读数 1275
点赞 71
article_banner

数据整理

tensorflow开发 之数字识别统计_数据


样本数量统计

tensorflow开发 之数字识别统计_数据_02


源码

# author: suoxd123@126.comimport tensorflow as tf# 读取数据mnist = tf.keras.datasets
.mnist(imgTrain, labelTrain),(imgTest, labelTest) = mnist.load_data(path='mnist.npz')1.2.3.4.5.6.

# author: suoxd123@126.com# 将2维矩阵变为1维向量print('source data structure')print
(imgTrain.shape, type(imgTrain))print(imgTest.shape, type(imgTest))imgTrain = imgTrain
.reshape(60000, 784)imgTest = imgTest.reshape(10000, 784)print('data structure after reshape')
print(imgTrain.shape, type(imgTrain))print(imgTest.shape, type(imgTest))
# 数据归一化处理imgTrain = imgTrain.astype('float32')imgTest = imgTest.astype('float32')imgTrain 
/= 255imgTest /= 2551.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.

# author: suoxd123@126.com# 统计当前实际数据import numpy as npimport matplotlib.pyplot as pltlabel, 
count = np.unique(labelTrain, return_counts=True)
# 打印数值对应数量print('0-9各数值对应的训练样本个数:')for m,n in zip(label, count): 
print("%d:%d;" % (m, n), end='')# 绘图显示对应数量fig = plt.figure()plt.bar(label, count, 
width = 0.6, align = 'center')plt.title('0-9 label distruibution')plt.xlabel('samble data')plt
.ylabel('quantity')plt.xticks(label)plt.ylim(0,8000) #设置y轴边界for m,n in zip(label, count):plt
.text(m,n, '%d'%n , ha = 'center', va = 'bottom', fontsize = 10)1.2.3.4.5.6.7.8.9.10.11.12.13.14.
15.16.17.18.19.20.21.

               

               


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删


武汉格发信息技术有限公司,格发许可优化管理系统可以帮你评估贵公司软件许可的真实需求,再低成本合规性管理软件许可,帮助贵司提高软件投资回报率,为软件采购、使用提供科学决策依据。支持的软件有: CAD,CAE,PDM,PLM,Catia,Ugnx, AutoCAD, Pro/E, Solidworks ,Hyperworks, Protel,CAXA,OpenWorks LandMark,MATLAB,Enovia,Winchill,TeamCenter,MathCAD,Ansys, Abaqus,ls-dyna, Fluent, MSC,Bentley,License,UG,ug,catia,Dassault Systèmes,AutoDesk,Altair,autocad,PTC,SolidWorks,Ansys,Siemens PLM Software,Paradigm,Mathworks,Borland,AVEVA,ESRI,hP,Solibri,Progman,Leica,Cadence,IBM,SIMULIA,Citrix,Sybase,Schlumberger,MSC Products...

相关文章
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空