【Tiny CNN】《Quantization Mimic: Towards Very Tiny CNN for Object Detection》

在这里插入图片描述

ECCV-2018



1 Background and Motivation

1)Accelerate CNNs 的方法:

  • Quantization(filters/weights):eg 二进制,或者 2的幂+ 0
  • Group convolution(MobileNet、ShuffleNet、Xception)
  • Pruning(weight importance)and Sparse connection(parameter-wise)
  • Mimic(Knowledge Transfer)

but VGG to VGG-1-14 or VGG-1-16(本文 VGG-1-32)

2)Notion:

  • Quantization:convert a full-precision network to a quantized one(teacher network)
  • Mimictransfer knowledge from teacher network to student network

但是Quantization 往往需要 extra speci fic implementation(FPGA),Mimic (does not work well on very tiny network),本文用 Quantization + Mimic 来做 model compression

3)Quantization 和 Mimic 的关系

The quantization operation can help student network to better match the feature maps from teacher network(别人用 quantization 来 compression model,作者用 quantization 是为了 mimic learning).

2 Innovation

  • Quantization + Mimic for object detection(first)

It first quantizes the large network, then mimic a quantized small network.

3 Advantages / Contributions

  • Very tiny(1/32):propose an effective algorithm to train very tiny networks(first work).
  • Quantization + Mimic:utilize quantized feature maps to facilitate knowledge distilling,二合一,大大降低模型复杂度和计算量
  • Effectiveness:vertify it by using object detection(more difficult),not classification
  • Easy to implement:no special limitation during training and inference., although two stage family,easy transform to YOLO and SSD

4 Methods

Backbone:

  • VGG with R-FCN
  • Resnet with Faster R-CNN

在这里插入图片描述

4.1 Quantization

别人用量化直接去压缩模型,作者用量化是为了更好的 mimic

Uniform quantization can better describe large value than power of two quantization.

作者用的是 Uniform quantization,因为 object detection 中 RoI pooling 是 max pooling,要保证大数值的量化质量( 2 2 , 2 3 , 2 4 2^2,2^3, 2^4 22,23,24 跳跃还是太大了)。

量化经过激活函数后的 feature map,不量化梯度,梯度用 full-precision(正常网络) 的
在这里插入图片描述

4.2 Mimic

如下是 【Mimic】《Mimicking Very Efficient Network for Object Detection》当中的方法,下图只是 RPN,加上头部的监督信息(引入类别信息)会更好,加入头部信息后叫 two-stage-mimic
在这里插入图片描述

本篇论文都采用的是 two-stage-mimic,文中的叫法为 joint-train version
在这里插入图片描述

  • r:rpn
  • d:detection
  • s:student
  • t:teacher
  • N:number of RoI
  • i:i-th RoI
  • f:feature map
  • r:regression function 让学生提取出来的 RoI 大小等于老师的

4.3 Quantization + Mimic

在这里插入图片描述

损失在 mimic 的基础上加个量化操作
在这里插入图片描述

老师 quantization,学生也 quantization。前者好理解,后者如何理解呢?
如果只是老师 quantization,而学生不 quantization
在这里插入图片描述
用流形(manifold)去拟合上图中8个中心点(每个格子的点都对quantization到相应的 * 中去)

如果学生也 Quantization 了,就相当于 用 8个中心点去拟合 8个中心点,问题变得更简单,实验证明,这样效果也是最好的

问题来了,什么是流形(manifold)呢?参考
机器学习算法总结(十二)——流形学习(Manifold Learning)

在这里插入图片描述

5 Datasets

Database:

  • WIDER FACE
    32K images with 394K annotated faces
    validation and test:easy , medium and hard subsets.
  • Pascal VOC

在这里插入图片描述
http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/

6 Experiments

6.1 WIDER FACE

  • Structure:VGG with R-FCN
  • teacher:VGG-1-4(因为和 VGG效果差不多,见表3)
  • student:VGG-1-32
  • loss 中 λ = 1 \lambda = 1 λ=1
  • RPN 的 anchor:1 ratio,4 scales 4 2 , 8 2 , 1 6 2 , 3 2 2 4^2,8^2,16^2,32^2 42,82,162,322
  • RoI Pooling 后:3*3
  • OHEM

在这里插入图片描述
看出比 scratch (不用ImageNet 预训练,为什么不呢,因为channels太小,容量不够)要好,这样表示作者的 student network 从 teacher network 中学到东西了。


进化,超进化:Speed and Size
在这里插入图片描述


舌战群儒:Comparison with other 压缩模型
在这里插入图片描述

可以看出 Quantization+Mimic 夺魁,且注意到 Group Convolution 效果不好,作者的解释是 channels 太少,这样会 block the information flow.


砍你一只手,看你是不是杨过那样的大侠,Quantization vs Nonquantization:
在这里插入图片描述
实验表明,他不是杨过,同时在 teacher 和 student network 中 quantization 效果最好。前两行的对比也表明了老师提炼的知识的好坏(量化与否),直接影响了学生的学习好坏。


量化是有 regularization 的作用的,验证一下,我们效果的提升是不是只是因为量化的 regularization 作用
在这里插入图片描述
teacher network 不量化,实验表明,只 quantization student network 不提升效果。说明还是这种 mimic 的方式在起作用,quantization 是为了更好的mimic。


横轴是 matching ratios,纵轴是分布在各个 matching ratios 区间中的百分比。匹配的计算方式是 ∣ f i s − f i t ∣ |f_i^s-f_i^t| fisfit smaller than a threshold(0.3)
在这里插入图片描述


uniform quantization vs power of 2
power of 2 如下
在这里插入图片描述

在这里插入图片描述
下面 VGG-1-32 中 teacher network 采用的是 uniform

uniform 的 quantization 要好,作者分析这主要是因为 teacher network 的监督信息主要来自 RoI,max pooling 要保证大数值的量化质量,power of 2 中 2 2 , 2 3 , 2 4 2^2,2^3, 2^4 22,23,24 跳跃还是太大了。这种方法对 0-1之间的值的量化非常好。

6.2 PASCAL VOC

  • Structure:ResNet-18 with Faster RCNN
  • teacher:ResNet-18(见附录 ResNet-18)
  • student:ResNet-18-16
  • loss 中 λ \lambda λ 见 Table 9
  • RPN 的 anchor:2 ratio(2:1,3:1),3 scales 4 2 , 8 2 , 1 6 2 4^2,8^2,16^2 42,82,162
  • RoI Pooling 后:7*7

在这里插入图片描述
比 scratch好很多,说明方法的有效性


现任 vs 前任(Quantization + Mimic vs only Mimic)
在这里插入图片描述
前任是【Mimic】《Mimicking Very Efficient Network for Object Detection》
分手还是有道理的


λ \lambda λ 值的讨论
作者把他叫做 “gradient focus” 的问题,就是如果 λ \lambda λ 太大,学生只听老师的话(来自 teacher network 的监督信息——RoI feature),不看书(data), λ \lambda λ 太小,学生只看书,不听讲。

在这里插入图片描述

和 WIDER FACE 一样, λ = 1 \lambda = 1 λ=1 效果最好

7 Conclusions / Feature work

7.1 Conclusions

  • Quantization + Mimic = very tiny(more than 1/16)
  • Quantization(backbone last feature map,after activation,before RoI pooling) 是为了更好的 Mimic

7.2 Future work

We hope our approach can facilitate future research on training very tiny CNNs for cutting-edge applications.

【附录】 ResNet-18

在这里插入图片描述
ResNet-18 caffe代码
scale_param 层的解释
可视化工具

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值