# 基于深度学习的手写数字识别算法Python实现
# 摘 要
深度学习是传统机器学习下的一个分支,得益于近些年来计算机硬件计算能力质的飞跃,使得深度学习成为了当下热门之一。手写数字识别更是深度学习入门的经典案例,学习和理解其背后的原理对于深度学习的理解有很重要的作用。
本文将采用深度学习中的卷积神经网络来训练手写数字识别模型。使用卷积神经网络建立合理的模型结构,利用卷积层中设定一定数目的卷积核(即滤波器),通过训练数据使模型学习到能够反映出十个不同手写提数字特征的卷积核权值,最后通过全连接层使用softmax函数给出预测数字图对应每种数字可能性的概率多少。
本文以学习基于深度学习的手写数字识别算法的过程为线索,由简入深,从最基础的感知器到卷积神经网络,学习和理解深度学习的相关基本概念、模型建立以及训练过程。在实现典型LeNet-5网络结构的同时,通过更改超模型结构、超参数进一步探索这些改变对模型准确率的影响。最后通过使用深度学习框架Keras以MNIST作为训练数据集训练出高识别率的模型并将其与OpenCV技术结合应用到摄像头上实现实时识别数字,使用合理的模型结构,在测试集上识别准确率达到99%以上,在与摄像头结合实际应用中的识别效果达到90%以上。
**关键词**:深度学习,卷积神经网络,MNIST,OpenCV
# ABSTRACT
Depth learning is a branch of traditional machine learning, thanks to the recent years, computer hardware computing power of the quality of the leap, making the depth of learning has become one of the popular. Handwritten digital recognition is the classic case of advanced learning, learning and understanding the principles behind the depth of learning for the understanding of a very important role.
In this paper, the convolution neural network in depth learning will be used to train the handwritten numeral recognition model. The convolution neural network is used to establish a reasonable model structure. A certain number of convolution cores (ie, filters) are set in the convolution layer. The training data are used to study the convolution of the model to reflect ten different handwritten digital features Kernel weight, and finally through the full connection layer using soft max function gives the predicted digital map corresponding to the probability of each number of the probability of how much.
In this paper, we study the basic concepts, model establishment and training process of the depth learning based on the process of learning the handwritten numeral recognition algorithm based on the depth learning. The basic concepts, the model establishment and the training process are studied and understood from the most basic sensor to the convolution neural network. In the realization of the typical LeNet-5 network structure at the same time, by changing the super-model structure, super-parameters to further explore the impact of these changes on the model accuracy. Finally, by using the depth learning framework Keras to MNIST as a training data set to train a high recognition rate model and combine it with OpenCV technology to apply real-time identification numbers to the camera,using a reasonable model structure, the recognition accuracy is achieved on the test set More than 99%, with the camera in the practical application of the recognition effect of more than 90%.
**Key words:** deep Learning, convolution neural network, MNIST, OpenCV
# 1 绪论
## 1.1 数字识别研究现状
早期的研究人员在数字识别[1]这一方向已经取得了不错的成果,如使用K-邻近分类方法,SVM分类方法,Boosting分类方法等。但这些方法多少都会有不足之处,例如K-邻近方法在预测时需要将所有的训练数据集加载至内存,然后用待测数字图片与训练集作对应像素点差的和,最后得出的差值最小的则为预测结果。显然这样的方法在正常的图片准确度上并不可靠,对于待测手写数字的要求也很高。目前识别率最好的模型应该还属基于深度学习的CNN,最典型的例子LeNet-5,美国最早将其商用到识别银行支票上得手写数字[2]。可见基于深度学习的手写数字识别在准确率上是相当可靠。
## 1.2 深度学习的发展与现状
机器学习[3]发展大致分为两个阶段,起源于浅层学习,发展于深度学习,深度学习是机器学习的一个重要分支。
在20世纪80年代末期,反向传播算法的应用给机器学习带来了希望的同时也掀起了基于统计模型的机器学习热潮。通过实践,人们成功发现利用反向传播算法可以使一个人工神经网络模型在大量有标签训练样本中学习统计一定的规律,在此之上进而对无标签事物进行预测。该阶段的的网络模型因为只含有一层隐含层的缘故被称之为浅层模型,浅层模型在参数个数、计算单元以及特征表达上有一定瓶颈。90年代,学术界相继提出各种各样的浅层学习模型,如支持向量机(SVM,supportVector Machine)、Boosting、最大熵方法等。这些模型相比当时的神经网络模型不论是在效率上还是在准确率上都有一定提升[4]。
直到2006年,加拿大多伦多大学教授、机器学习领域泰斗Geoffrey Hinton和他的学生在Ruslan Salakhutdinov在《科学》上发表的一篇关于“deep learning”的综述文章,正式开启了深度学习的浪潮[5]。深度学习火 起来的标志事件是2012年Geoff Hinton的博士生Alex Krizhevsky、Ilya Sutskever使用深度学习在图片分类的竞赛ImageNet上取得了识别结果第一名的好成绩,并且在识别精度上领先于同样使用深度学习进行识别的Google团队。这里的谷歌团队不是一般的团队,而是由机器学习领域的领跑者Andrew Ng和Google神人 Jeff Dean带领下有着他人团队无法企及的硬件资源和数据资源支持的团队,而打败这个顶级团队的仅仅是两个研究深度学习不久的“小毛孩”,这令学术界和工业届哗然的同时,也吸引了工业界对深度学习的大规模投入。Google收购了Hinton的DNN初创公司,并邀请Hinton加入了Google;LeCun加盟Facebook并出任AI实验室主任;百度成立了自己的深度学习研究所,并邀请到了原负责Google Brain的吴恩达。深度学习发展之快令人吃惊,在2016年初谷歌建立的AlphaGo系统在与围棋世界冠军李世石的对弈中,最终AlphaGo以4:1的大比分应得了比赛的胜利。可以看出,人工智能的第三波浪潮也是和深度学习密不可分的。深度学习里最经典的模型是全连接的神经网络、卷积神经网络CNN以及循环神经网络RNN。还有一个非常重要的技术就是深度强化学习技术,而AlphaGo所采用的就是该技术。
深度学习的成功归功于三大因素——大数据、大模型、大计算。同时这个三个方向也是当前研究的热点。受益于计算能力的提升和大数据的出现,深度学习在现在的条件下可以将模型层次加深到上亿神经元的计算量的等级。GPU对深度学习计算的支持也放低了进行深度学习研究的门槛,使更多的初学研究人员可以踏足这个领域,为这个领域不断注入新鲜血液,不断提出新的思考,开阔新的应用方向。
深度学习的本质是通过构建多层隐藏层的机器学习模型和大量的训练数据,在训练中不断调整参数以寻找能反应数据集特点的特征,从而提升类似数据的分类或预测准确性。“深度模型”是手段,而“特征学习”是目的。有别于传统的浅层学习,深度学习强调了模型除输入输�
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
20938816243070335.zip (77个子文件)
hand-number-python
src
毕业设计.docx 2.22MB
毕业设计源码
lenet5
log_Lenet.txt 3KB
model-LeNet5.png 33KB
LeNet5.py 3KB
fina_mode.py 2KB
lenet_5.h5 6.91MB
find_numxy.py 2KB
图像处理
test.jpg 38KB
sobel_screenshot_02.06.2017.png 176KB
erode_screenshot_02.06.2017.png 49KB
test7.jpeg 835B
whre num_screenshot_02.06.2017.png 161KB
absdiff_screenshot_02.06.2017.png 130KB
imagedeal.py 2KB
dilate_screenshot_02.06.2017.png 47KB
num1_screenshot_03.06.2017.png 385B
final-model.h5 747KB
lenet-5
6.bmp 2KB
lenet.py 3KB
model-cnn.png 28KB
a.bmp 2KB
test_mode.py 2KB
type-history.py 2KB
lenet_5.h5 6.91MB
My Camera_screenshot_03.06.2017.png 288KB
log_sgd_big_32.txt 1KB
test7.jpeg 835B
final-model.h5 747KB
distinguish_num.py 3KB
dic-str.py 330B
1.06.2017.png 253KB
b.bmp 2KB
17.png 257KB
My Camera_screenshot_11.06.2017.png 294KB
train_mode.py 2KB
reenshot_11.06.2017.png 266KB
log.txt 515B
CNN2卷积层参数
cnn2-2.py 3KB
cnn2-1.png 33KB
cnn2-1.py 3KB
cnn2-2.png 33KB
cnn2-2.txt 3KB
cnn2-1.txt 3KB
fina_model.png 47KB
CNN4激活函数
cnn4-2.py 3KB
cnn4-3.py 3KB
4-1.txt 3KB
4-1.png 33KB
4-2.txt 3KB
4-3.txt 3KB
4-3.png 33KB
cnn4-1.py 3KB
4-2.png 33KB
CNN3权值初始化
cnn3-2.txt 3KB
cnn3-1.py 3KB
cnn3-3.png 33KB
cnn3-4.png 33KB
cnn3-2.png 33KB
cnn3-1.txt 3KB
cnn3-3.txt 3KB
cnn3-3.py 3KB
cnn3-2.py 3KB
cnn3-4.txt 3KB
cnn3-1.png 33KB
cnn3-4.py 3KB
draw-loss-acc.py 484B
CNN1不同结构
cnn1-3.png 38KB
cnn1-2.py 3KB
cnn1-1.py 3KB
cnn1-1.txt 3KB
cnn1-2.png 35KB
cnn1-1.png 34KB
cnn1-2.txt 3KB
cnn1-3.py 3KB
cnn1-3.txt 3KB
LICENSE 1KB
README.md 62KB
共 77 条
- 1
资源评论
- sytsumi2023-04-25这个资源值得下载,资源内容详细全面,与描述一致,受益匪浅。
- 2301_774735202023-10-03终于找到了超赞的宝藏资源,果断冲冲冲,支持!
工具盒子
- 粉丝: 60
- 资源: 1313
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功