摘 要
深度学习是传统机器学习下的一个分支,得益于近些年来计算机硬件计算能力质的飞跃,使得深度学习成为了当下热门之一。手写数字识别更是深度学习入门的经典案例,学习和理解其背后的原理对于深度学习的理解有很重要的作用。
本文将采用深度学习中的卷积神经网络来训练手写数字识别模型。使用卷积神经网络建立合理的模型结构,利用卷积层中设定一定数目的卷积核(即滤波器),通过训练数据使模型学习到能够反映出十个不同手写提数字特征的卷积核权值,最后通过全连接层使用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 softmax 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
目 录
摘要 I
ABSTRACT II
1 绪论 1
1.1 数字识别研究现状 1
1.2 深度学习的发展与现状 1
1.3 研究意义 2
1.4 论文结构 3
2 卷积神经网络基本原理 4
2.1 卷积神经网络 4
2.1.1 卷积神经网络概述 4
2.1.2 卷积神经网络的重要组成部分 4
2.1.3 权值共享和局部连接 5
2.2 神经网络的前向传播和反向传播 6
2.2.1 神经元 6
2.2.2 神经网络的连接形式 7
2.2.3 神经网络的前向传播 8
2.2.4 神经网络的反向传播算法 8
2.3 优化方法——梯度下降 9
2.3.1 批梯度下降 9
2.3.2 随机梯度下降 11
2.3.3 小批量梯度下降 11
2.4 小结 11
3 Keras深度学习框架 12
3.1 Keras简介 12
3.2 Keras编程 12
3.2.1 Keras模型构建 12
3.2.2 Keras常用函数及用法 12
3.3 Keras环境配置 13
3.4 小结 14
4 经典LeNet-5实验探究 15
4.1 数据集MNIST介绍 15
4.2 LeNet-5实现 16
4.2.1 LeNet-5介绍 16
4.2.2 LeNet实现 16
4.3 模型探究 18
4.3.1 不同网络结构 18
4.3.2 卷积核大小数量 20
4.3.2 权值初始化 22
4.3.3 激活函数选择 24
4.4 小结 26
5 手写数字识别算法应用实践 27
5.1 OpenCV图像处理部分 27
5.1.1 OpenCV介绍 27
5.1.2 OpenCV安装配置 27
5.1.3 寻找数字 28
5.1.4 数字处理 32
5.2 实现摄像头的手写数字实时识别 33
5.2.1 手写数字识别模型训练 33
5.2.2 模型的保存与调用 35
5.2.3 结果 36
5.3小结 36
6 总结 38
致 谢 39
参考文献 40