深度学习笔记-VGG
网络结构
- 通过堆叠多个卷积核也就是多层卷积,来替代大尺度卷积核,从而减少网络中的参数。多个小卷积核与大卷积核具有相同的感受野
感受野
决定某一层输出结果中一个元素所对应的输入层的区域大小,被称为感受野。简单来说就是输出的特征图的一个单元对应输入层区域的大小。
感受野的计算
网络搭建
model
VGG网络搭建与之前的LetNet、AlexNet有所不同,VGG网络有多个不同的结构,且网络较深,若按照之前那样逐个搭建比较耗费时间,因此采用一种较为简便的方法搭建。
1 | # 网络结构 |
首先定义一个网络结构字典,存放不同的网络结构列表,其中数字x代表输出通道为x的卷积层,字符‘M’代表最大池化层。然后编写一个函数用于生成feature层网络结构,由于VGG网络的卷积层和池化层的其他参数一致,因此只需要遍历配置列表按顺序添加池化层或对应的卷积层。
1 | class VGG(nn.Module): |
训练与预测
网络的训练及预测与之前的步骤大致相同,不再赘述。
笔记根据B站UP主霹雳吧啦Wz视频合集【深度学习-图像分类篇章】学习整理
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自DaneSun's Blog
评论
匿名评论
✅ 你无需删除空行,直接评论以获取最佳展示效果