CNN Architectures 今日首绷 计算题 4 bytes per elem
右边三列体现了一个规律 2013的ImageNet winner仍然是AlexNet变体(ZFNet, ECCV),只是trial and error的结果
2014的ImageNet winner是VGGNet ICLR,提出了规则化 3x3卷积核? 两个3x3卷积核 比 一个5x5卷积核 Params和FLOPs更少,但是感受野一样,并且可以插入更多的relu channel翻倍,每次卷积计算cost same amount of floating points computation 2014的ImageNet有GoogLeNet CVPR:
初期快速下采样 Inception模块: 1x1, 3x3, 5x5卷积核(使得kernel size不再是一个超参数) 1x1适配器的引入 resnet雏形 Global Average Pooling: 替换掉一层fcnn 其次还有auxiliary classifier取中间层输出,作为loss加入到loss function中 2015年首先是BN被发现了,auxiliary classifier被弃用 接着ResNet CVPR:
引入残差结构,提升准确率 引入bottleneck结构,层数增加,但是flops减少 ECCV有一篇进一步讨论了残差块的结构 CVPR2017有一篇文章提出了ResNeXt 1 torch.nn.Conv2d(groups=) # groups参数控制了分组卷积的数量 2017年的ImageNet结束
DenseNet: fancier 趋势 MobileNet: 轻量化趋势 ICLR 2017自动化设计神经网络结构 Neural Architecture Search
Convolutional Neural Networks Components of a CNN Convolutional layers Pooling layers Normalization layers Convolutional Layers 注意到一个通道的卷积核也是全通道数 3 x5x5
偏置是一个向量
(b, c, h, w)表示batch size, channel, height, width!
注意四个维度的意义
卷积本质上也是一种linear layer,所以要relu等
高维全局,低维局部 1x1 Convolutions 一种适配器,调整通道数
other types of convolutions PyTorch Implementation Pooling Layers another way to downsample data, no learnable parameters
局部最大值微小移动不变性
Normalization Layers 主要讨论的是batch normalization
层与层之间数据分布更加稳定 此时
1 model.eval() 此时bn可以作为线形层被fuse进入fcnn or conv
layer norm也有,主要是rnn和transformer用到了 Example: LeNet-5
Backpropagation 参见cmu 10-414 😀
RNN 初见 Computation Graph 😏 A2要hardcode直接的反向传播了 555
真正的代码 😋
1 2 3 4 5 6 7 8 9 class Multiply(torch.autograd.Function): @staticmethod def forward(ctx, x, y): ctx.save_for_backward(x, y) return x * y @staticmethod def backward(ctx, grad_output): x, y = ctx.saved_tensors return grad_output * y, grad_output * x # 解析计算 PyTorch operators in deep engine 🤔
BP rules BP with vector-valued functions 假装标量求导,然后匹配矩阵形状即可(典中典)
element-wise functions in BP 不用使用矩阵求导,直接一一对应去想梯度的传递即可