RepVGG: Making VGG-style ConvNets Great Again

论文:https://arxiv.org/abs/2101.03697

代码:https://github.com/DingXiaoH/RepVGG

RepVGG是一种新颖的CNN设计范式,它将ACNet的思想与VGG架构进行了巧妙的结合,将plain模型的精度在ImageNet上提升到了超过80%top1精度。

作者指出当前CNN的问题:Though many complicated CNN deliver higher accuracy than simple ones, the drawbacks are significant:

  • complicated multi-branch designs make the model difficult to implement and customize, slow down the inference and reduce the memory utilization.
  • Some components (depthwise and the channel shuffle) increase the memory access cost. 当前一些方法的 FLOPs 值较低,但是内存开销大,速度并不快。

使用 simple CNN 主要有两个原因:

  • Fast. VGG16 的 FLOPs 是 EfficientNe-B3 的8.4倍,但是速度却快 1.8 倍,这主要是因为两个原因:首先是 memory access cost,组卷积会引起巨大的内存开销;然后是模型的并行度较低。
  • Memory-economical. 多分支结构并不能做到 memroy-economical,因为在结果合并前,结果每个分支的结果都要临时保存。

作者指出,The multi-branch topology has drawbacks for inference, but the branches seem beneficial to training. 因此,提出了 RepVGG模型,具体来说:decouple the training-time multi-branch and inference-time plain architecture via structural re-parameterization . 把训练模型转换到测试模型,通过 transforming parameters 来实现。RepVGG的架构如下图所示。可以看出,在训练阶段,RepVGG使用了1x1卷积和identity ,但在测试阶段就没有了。

这个论文的难点在于如何实现将训练模型转换成单一的 3x3 卷积用于 inference ,论文中有一个图说明了这个过程。在这个示例中,输入和输出的通道都是2,因此两个3X3的卷积参数是 2X2X3X3,可以是4个3X3的矩阵。1X1的卷积参数是一个2X2的矩阵。同时,三个分支都有BN,参数为累积得到的均值和缩放因子及bias 。推理时,BN层可以转化为一个带bias的卷积层。具体可以参照作者的论文。这样,可以把1X1的卷积用0填充成 3X3,这样,整个模型就是只有3X3的卷积的单路模型。具体可以参照作者的源代码,可惜并没有看得特别明白 ~~~ 汗 。。。

posted @ 2021-01-29 09:26  高峰OUC  阅读(870)  评论(0编辑  收藏  举报