LeNet5—论文及源码阅读

文章详细介绍了LeNet5的网络结构,包括卷积层C1、S2、C3、S4、C5以及全连接层F6和Output层,并解析了每层的功能。接着,文章展示了如何使用PyTorch实现LeNet5,包括数据预处理、模型构建、训练过程和模型保存。最后,提供了测试代码以加载模型并预测图像类别。
LeNet5实现图像分类

🐬 目录:


一、概论

LeNet-5是一种经典的卷积神经网络结构,于1998年投入实际使用中。该网络最早应用于手写体字符识别应用中。普遍认为,卷积神经网络的出现开始于LeCun等提出的LeNet网络,可以说LeCun等是CNN的缔造者,而LeNet则是LeCun等创造的CNN经典之作。

二、论文选读

论文: 《Gradient-Based Learning Applied to Document Recognition》


LeNet-5 comprises seven layers, not counting the input, all of which contain trainable parameters (weights). The input is a 32×32 pixel image.

理解: LeNet5共包含7层,输入为32×32像素的图片,如下图所示:

在这里插入图片描述



Layer C1 is a convolutional layer with six feature maps.Each unit in each feature map is connected to a 5✖5 neigh-borhood in the input.

理解: C1 层是卷积层,使用 6 个 5×5 大小的卷积核,padding=0,stride=1进行卷积,得到 6 个 28×28 大小的特征图:32-5+1=28



Layer S2 is a subsampling layer with six feature maps of size 14×14. Each unit in each feature map is connected to a 2×2 neighborhood in the corresponding feature map in C1.The four inputs to a unit in S2 are added, then multiplied by a trainable coefficient, and then added to a trainable bias.The result is passed through a sigmoidal function.

理解: S2 层是降采样层,使用 6 个 2×2 大小的卷积核进行池化,padding=0,stride=2,得到 6 个 14×14 大小的特征图:28/2=14。S2 层其实相当于降采样层+激活层。先是降采样,然后激活函数 sigmoid 非线性输出。先对 C1 层 2x2

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值