【数字识别】基于DBN实现minist数据集手写数字识别附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测 雷达通信  无线传感器

信号处理 图像处理 路径规划 元胞自动机 无人机  电力系统

⛄ 内容介绍​

深度置信网络(DeepBeliefNetwork,DBN)属于生成性深度学习结构。其可获取观测数据和相应类别的联合概率分布,能方便地预测先验概率和后验概率[2]。DBN网络可看作是多个RBM的叠加,第一个RBM的输入作为全局输入量,隐层输出作为下一层RBM的输入,最后一层RBM的输出为全局输出。在层叠RBM时,在输入端采用RBM连接,在输出段采用BP网络连接。DBN经过训练后的错误率仅为2.25%,具有较好的识别效果。BP网络通常结构是输入层,隐层和输出层构成。其训练由输入的前向传播以及误差的反馈传播构成。在正向传播结果和预期不符时,计算输出值与预期值的差值,并且按照梯度下降方式矫正连接权值,此过程直到网络输出误差满足要求为止。RBM(RestrictedBoltzmannMachine),是一种生成性概率模型,包括一个隐层和一个可视层。隐层单元与可视层单元通过权值矩阵和偏置向量全连接,层内单元不相互连接。RBM可以用来建模概率数据,能量函数和联合概率分布公式如下:RBM采用贪心逐层训练方式,每一层的参数训练好之后便将其固定,作为下一层RBM的可视层,训练下一层的参数,如此循环训练直到DBN所包含的所有RBM训练完毕。本文首先利用DBN预训练的权值和阈值对BP网络进行初始化,以获得更快的速度和更好的效果,然后利用Dropout技术对BP算法进行改进,提高算法速度与鲁棒性[3]。本文用DBN识别算法进行研究,并采用MNIST数据库手写体图像数据进行训练和测试。​

⛄ 部分代码

function labels = loadMNISTLabels(filename)

%loadMNISTLabels returns a [number of MNIST images]x1 matrix containing

%the labels for the MNIST images

fp = fopen(filename, 'rb');

assert(fp ~= -1, ['Could not open ', filename, '']);

magic = fread(fp, 1, 'int32', 0, 'ieee-be');

assert(magic == 2049, ['Bad magic number in ', filename, '']);

numLabels = fread(fp, 1, 'int32', 0, 'ieee-be');

labels = fread(fp, inf, 'unsigned char');

assert(size(labels,1) == numLabels, 'Mismatch in label count');

fclose(fp);

end

⛄ 运行结果

⛄ 参考文献

[1]黄浩然. 基于集成学习的MINIST手写数字识别[J]. 电子制作, 2018(18):3.

[2]张秀玲, 来永进, 高武杨,等. 基于DBN神经网络的板形识别研究[C]// 第35届中国控制会议. 0.

⛄ Matlab代码关注

❤️部分理论引用网络文献,若有侵权联系博主删除

❤️ 关注我领取海量matlab电子书和数学建模资料

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Code provided by Ruslan Salakhutdinov and Geoff Hinton Permission is granted for anyone to copy, use, modify, or distribute this program and accompanying programs and documents for any purpose, provided this copyright notice is retained and prominently displayed, along with a note saying that the original programs are available from our web page. The programs and documents are distributed without any warranty, express or implied. As the programs were written for research purposes only, they have not been tested to the degree that would be advisable in any important application. All use of these programs is entirely at the user's own risk. How to make it work: 1. Create a separate directory and download all these files into the same directory 2. Download from http://yann.lecun.com/exdb/mnist the following 4 files: o train-images-idx3-ubyte.gz o train-labels-idx1-ubyte.gz o t10k-images-idx3-ubyte.gz o t10k-labels-idx1-ubyte.gz 3. Unzip these 4 files by executing: o gunzip train-images-idx3-ubyte.gz o gunzip train-labels-idx1-ubyte.gz o gunzip t10k-images-idx3-ubyte.gz o gunzip t10k-labels-idx1-ubyte.gz If unzipping with WinZip, make sure the file names have not been changed by Winzip. 4. Download Conjugate Gradient code minimize.m 5. Download Autoencoder_Code.tar which contains 13 files OR download each of the following 13 files separately for training an autoencoder and a classification model: o mnistdeepauto.m Main file for training deep autoencoder o mnistclassify.m Main file for training classification model o converter.m Converts raw MNIST digits into matlab format o rbm.m Training RBM with binary hidden and binary visible units o rbmhidlinear.m Training RBM with Gaussian hidden and binary visible units o backprop.m Backpropagation for fine-tuning an autoencoder o backpropclassify.m Backpropagation for classification using "encoder" network o CG_MNIST.m Conjugate Gradient optimization for fine-tuning an autoencoder o CG_CLASSIFY_INIT.m Co

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值