目录

前言:

SqueezeNet模型原理

Fire Module

SqueezeNet模型结构

SqueezeNet模型特点

SqueezeNet网络实现


前言:

CNN网络模型一直在追求识别成功率,从AlexNet到VGGNet模型,识别精度不断提高,TOP-5错误率从15.3%下降到7.3%,但参数数量也越来越多,但参数数量也越来越多,从60M增加到140M。过多的参数降低了分布式训练的效率,也给数据传输所需的网络带宽造成很大的负担。如何在保证识别精度的情况下,对网络参数进行压缩是需要进一步研究的方向。

本篇介绍的SqueezeNet模型(压缩模型)就是为了解决这一问题而提出的网路模型。本篇先阐述SqueezeNet模型的基本理论,然后解读Caffe的实现,最后介绍Caffe环境下的训练方法。

SqueezeNet模型原理

SqueezeNet设计目标不是为了得到最佳的CNN识别精度,而是希望在简化网络复杂度的同时保证网络模型的识别精度。

SqeezeNet模型的设计用以下三个方法简化网络复杂度:

(1)替换3x3的卷积核为1x1的卷积核。从AlexNet模型发展到现在,因为设计上的简洁和有效性,卷积核的大小都选择3x3.SqueezeNet模型用1x1的卷积核替换3x3的卷积核可以让网络参数缩小9倍。但是为了不影响识别精度,只做了部分替换。

(2)减少输入3x3卷积的输入特征数量。将卷积层分解为squeeze层以及expand层,并封装为一个Fire Module。

(3)在整个网络后期进行下采样,使得卷积层有较大的activation maps。

Fire Module

Fire Module是SqueezeNet的核心构件,其思想非常简单。即将一个卷积层分解为一个Squeeze层和一个expand层,并各自带上Relu激活曾。squeeze层包含全部都是1x1的卷积核,共有S个。expand层包含1x1核3x3的卷积核,其中1x1的卷积核有E1个,3x3的卷积核有E3个,要求满足S<(E1+E3)。如下图FireModule结构:

SqueezeNet模型结构

SqueezeNet的网络模型结构如图:

SqueezeNet模型共有九层Fire Module,中间穿插了三个MAX pooling层,最后一层用Average Pooling层替换全连接层是的参数大量减少。SqueezeNet网络模型在最上层核下层各保留了一个卷积层,这样做的目的是保证输入输出的大小可掌握。其他参数细节设置在下面caffe实现中会详细介绍。下表给出了每层的维度:

SqueezeNet模型特点

(1)SqueezeNet比AlexNet的参数减少的50倍,模型大小只有4.8M,在性能好的FPGA上可以运行起来,并且能带来与AlexNet相当的识别精度。

(2)SqueezeNet证明了小的神经网络也能达到很好的识别精度,这使得未来将嵌入式设备或移动设备植入神经网络成为一种可能。

SqueezeNet网络实现

# please cite:
# @article{SqueezeNet,
#     Author = {Forrest N. Iandola and Matthew W. Moskewicz and Khalid Ashraf and Song Han and William J. Dally and Kurt Keutzer},
#     Title = {SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and $<$1MB model size},
#     Journal = {arXiv:1602.07360},
#     Year = {2016}
# }
layer {name: "data"       //data层type: "Data"top: "data"top: "label"include {phase: TRAIN}transform_param {crop_size: 227mean_value: 104mean_value: 117mean_value: 123}data_param {source: "examples/imagenet/ilsvrc12_train_lmdb" //训练数据集batch_size: 32backend: LMDB}
}
layer {name: "data"type: "Data"top: "data"top: "label"include {phase: TEST}transform_param {crop_size: 227mean_value: 104mean_value: 117mean_value: 123}data_param {source: "examples/imagenet/ilsvrc12_val_lmdb"batch_size: 25 #not *iter_sizebackend: LMDB}
}
layer {                 //第一个卷积层,缩小输入图像,提取96维特征name: "conv1"type: "Convolution"bottom: "data"top: "conv1"convolution_param {num_output: 64kernel_size: 3stride: 2weight_filler {type: "xavier"}}
}
layer {                  //RELU层name: "relu_conv1"type: "ReLU"bottom: "conv1"top: "conv1"
}
layer {name: "pool1"          //第一个Max Pooling层,降采样,缩小一半type: "Pooling"bottom: "conv1"top: "pool1"pooling_param {pool: MAXkernel_size: 3stride: 2}
}
layer {                  //第一个fire模块,模块内先用squeeze层减少通道数,再用expand层增加通道数name: "fire2/squeeze1x1"type: "Convolution"bottom: "pool1"top: "fire2/squeeze1x1"convolution_param {num_output: 16kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire2/relu_squeeze1x1"type: "ReLU"bottom: "fire2/squeeze1x1"top: "fire2/squeeze1x1"
}
layer {name: "fire2/expand1x1"type: "Convolution"bottom: "fire2/squeeze1x1"top: "fire2/expand1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire2/relu_expand1x1"type: "ReLU"bottom: "fire2/expand1x1"top: "fire2/expand1x1"
}
layer {name: "fire2/expand3x3"type: "Convolution"bottom: "fire2/squeeze1x1"top: "fire2/expand3x3"convolution_param {num_output: 64pad: 1              //增加一个像素边界,是的1x1和3x3filter对齐kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire2/relu_expand3x3"type: "ReLU"bottom: "fire2/expand3x3"top: "fire2/expand3x3"
}
layer {name: "fire2/concat"type: "Concat"bottom: "fire2/expand1x1"bottom: "fire2/expand3x3"top: "fire2/concat"
}
layer {name: "fire3/squeeze1x1"type: "Convolution"bottom: "fire2/concat"top: "fire3/squeeze1x1"convolution_param {num_output: 16kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire3/relu_squeeze1x1"type: "ReLU"bottom: "fire3/squeeze1x1"top: "fire3/squeeze1x1"
}
layer {name: "fire3/expand1x1"type: "Convolution"bottom: "fire3/squeeze1x1"top: "fire3/expand1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire3/relu_expand1x1"type: "ReLU"bottom: "fire3/expand1x1"top: "fire3/expand1x1"
}
layer {name: "fire3/expand3x3"type: "Convolution"bottom: "fire3/squeeze1x1"top: "fire3/expand3x3"convolution_param {num_output: 64pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire3/relu_expand3x3"type: "ReLU"bottom: "fire3/expand3x3"top: "fire3/expand3x3"
}
layer {name: "fire3/concat"type: "Concat"bottom: "fire3/expand1x1"bottom: "fire3/expand3x3"top: "fire3/concat"
}
layer {name: "pool3"type: "Pooling"bottom: "fire3/concat"top: "pool3"pooling_param {pool: MAXkernel_size: 3stride: 2}
}
layer {name: "fire4/squeeze1x1"type: "Convolution"bottom: "pool3"top: "fire4/squeeze1x1"convolution_param {num_output: 32kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire4/relu_squeeze1x1"type: "ReLU"bottom: "fire4/squeeze1x1"top: "fire4/squeeze1x1"
}
layer {name: "fire4/expand1x1"type: "Convolution"bottom: "fire4/squeeze1x1"top: "fire4/expand1x1"convolution_param {num_output: 128kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire4/relu_expand1x1"type: "ReLU"bottom: "fire4/expand1x1"top: "fire4/expand1x1"
}
layer {name: "fire4/expand3x3"type: "Convolution"bottom: "fire4/squeeze1x1"top: "fire4/expand3x3"convolution_param {num_output: 128pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire4/relu_expand3x3"type: "ReLU"bottom: "fire4/expand3x3"top: "fire4/expand3x3"
}
layer {name: "fire4/concat"type: "Concat"bottom: "fire4/expand1x1"bottom: "fire4/expand3x3"top: "fire4/concat"
}
layer {name: "fire5/squeeze1x1"type: "Convolution"bottom: "fire4/concat"top: "fire5/squeeze1x1"convolution_param {num_output: 32kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire5/relu_squeeze1x1"type: "ReLU"bottom: "fire5/squeeze1x1"top: "fire5/squeeze1x1"
}
layer {name: "fire5/expand1x1"type: "Convolution"bottom: "fire5/squeeze1x1"top: "fire5/expand1x1"convolution_param {num_output: 128kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire5/relu_expand1x1"type: "ReLU"bottom: "fire5/expand1x1"top: "fire5/expand1x1"
}
layer {name: "fire5/expand3x3"type: "Convolution"bottom: "fire5/squeeze1x1"top: "fire5/expand3x3"convolution_param {num_output: 128pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire5/relu_expand3x3"type: "ReLU"bottom: "fire5/expand3x3"top: "fire5/expand3x3"
}
layer {name: "fire5/concat"type: "Concat"bottom: "fire5/expand1x1"bottom: "fire5/expand3x3"top: "fire5/concat"
}
layer {name: "pool5"type: "Pooling"bottom: "fire5/concat"top: "pool5"pooling_param {pool: MAXkernel_size: 3stride: 2}
}
layer {name: "fire6/squeeze1x1"type: "Convolution"bottom: "pool5"top: "fire6/squeeze1x1"convolution_param {num_output: 48kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire6/relu_squeeze1x1"type: "ReLU"bottom: "fire6/squeeze1x1"top: "fire6/squeeze1x1"
}
layer {name: "fire6/expand1x1"type: "Convolution"bottom: "fire6/squeeze1x1"top: "fire6/expand1x1"convolution_param {num_output: 192kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire6/relu_expand1x1"type: "ReLU"bottom: "fire6/expand1x1"top: "fire6/expand1x1"
}
layer {name: "fire6/expand3x3"type: "Convolution"bottom: "fire6/squeeze1x1"top: "fire6/expand3x3"convolution_param {num_output: 192pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire6/relu_expand3x3"type: "ReLU"bottom: "fire6/expand3x3"top: "fire6/expand3x3"
}
layer {name: "fire6/concat"type: "Concat"bottom: "fire6/expand1x1"bottom: "fire6/expand3x3"top: "fire6/concat"
}
layer {name: "fire7/squeeze1x1"type: "Convolution"bottom: "fire6/concat"top: "fire7/squeeze1x1"convolution_param {num_output: 48kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire7/relu_squeeze1x1"type: "ReLU"bottom: "fire7/squeeze1x1"top: "fire7/squeeze1x1"
}
layer {name: "fire7/expand1x1"type: "Convolution"bottom: "fire7/squeeze1x1"top: "fire7/expand1x1"convolution_param {num_output: 192kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire7/relu_expand1x1"type: "ReLU"bottom: "fire7/expand1x1"top: "fire7/expand1x1"
}
layer {name: "fire7/expand3x3"type: "Convolution"bottom: "fire7/squeeze1x1"top: "fire7/expand3x3"convolution_param {num_output: 192pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire7/relu_expand3x3"type: "ReLU"bottom: "fire7/expand3x3"top: "fire7/expand3x3"
}
layer {name: "fire7/concat"type: "Concat"bottom: "fire7/expand1x1"bottom: "fire7/expand3x3"top: "fire7/concat"
}
layer {name: "fire8/squeeze1x1"type: "Convolution"bottom: "fire7/concat"top: "fire8/squeeze1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire8/relu_squeeze1x1"type: "ReLU"bottom: "fire8/squeeze1x1"top: "fire8/squeeze1x1"
}
layer {name: "fire8/expand1x1"type: "Convolution"bottom: "fire8/squeeze1x1"top: "fire8/expand1x1"convolution_param {num_output: 256kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire8/relu_expand1x1"type: "ReLU"bottom: "fire8/expand1x1"top: "fire8/expand1x1"
}
layer {name: "fire8/expand3x3"type: "Convolution"bottom: "fire8/squeeze1x1"top: "fire8/expand3x3"convolution_param {num_output: 256pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire8/relu_expand3x3"type: "ReLU"bottom: "fire8/expand3x3"top: "fire8/expand3x3"
}
layer {name: "fire8/concat"type: "Concat"bottom: "fire8/expand1x1"bottom: "fire8/expand3x3"top: "fire8/concat"
}
layer {name: "fire9/squeeze1x1"type: "Convolution"bottom: "fire8/concat"top: "fire9/squeeze1x1"convolution_param {num_output: 64kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire9/relu_squeeze1x1"type: "ReLU"bottom: "fire9/squeeze1x1"top: "fire9/squeeze1x1"
}
layer {name: "fire9/expand1x1"type: "Convolution"bottom: "fire9/squeeze1x1"top: "fire9/expand1x1"convolution_param {num_output: 256kernel_size: 1weight_filler {type: "xavier"}}
}
layer {name: "fire9/relu_expand1x1"type: "ReLU"bottom: "fire9/expand1x1"top: "fire9/expand1x1"
}
layer {name: "fire9/expand3x3"type: "Convolution"bottom: "fire9/squeeze1x1"top: "fire9/expand3x3"convolution_param {num_output: 256pad: 1kernel_size: 3weight_filler {type: "xavier"}}
}
layer {name: "fire9/relu_expand3x3"type: "ReLU"bottom: "fire9/expand3x3"top: "fire9/expand3x3"
}
layer {name: "fire9/concat"type: "Concat"bottom: "fire9/expand1x1"bottom: "fire9/expand3x3"top: "fire9/concat"
}
layer {name: "drop9"           //最后一个fire模块后,增加一个Dropout层type: "Dropout"bottom: "fire9/concat"top: "fire9/concat"dropout_param {dropout_ratio: 0.5   //丢弃率为50%}
}
layer {                  //第二个卷积层,为图的每个像素预测1000个分类name: "conv10"type: "Convolution"bottom: "fire9/concat"top: "conv10"convolution_param {num_output: 1000kernel_size: 1weight_filler {type: "gaussian"mean: 0.0std: 0.01}}
}
layer {name: "relu_conv10"type: "ReLU"bottom: "conv10"top: "conv10"
}
layer {                //average pooling层得到1000类name: "pool10"type: "Pooling"bottom: "conv10"top: "pool10"pooling_param {pool: AVEglobal_pooling: true}
}
layer {               //softmax层,使用softmax函数归一化为概率name: "loss"type: "SoftmaxWithLoss"bottom: "pool10"bottom: "label"top: "loss"#include {#  phase: TRAIN#}
}
layer {name: "accuracy"type: "Accuracy"bottom: "pool10"bottom: "label"top: "accuracy"#include {#  phase: TEST#}
}
layer {name: "accuracy_top5"type: "Accuracy"bottom: "pool10"bottom: "label"top: "accuracy_top5"#include {#  phase: TEST#}accuracy_param {top_k: 5}
}

SqueezeNet网络模型详解相关推荐

  1. OSI七层网络模型详解!

    本文章为沐一Gin的笔记&总结,转载请标明出处. 本文有下一章,如果看完后觉得有帮助就留个言呗,我会继续加油的! OSI七层网络模型 物理层(Physical Layer): 该层为上层协议提 ...

  2. Ristretto—SqueezeNet示例详解

    SqueezeNet量化 1)根目录下执行sh ./data/ilsvrc12/get_ilsvrc_aux.sh  获得数据集的train.txt以及val.txt 2)  根目录下执行 sh ./ ...

  3. 【深度学习】ResNet——CNN经典网络模型详解(pytorch实现)

    建议大家可以实践下,代码都很详细,有不清楚的地方评论区见~ 1.前言 ResNet(Residual Neural Network)由微软研究院的Kaiming He等四名华人提出,通过使用ResNe ...

  4. GoogLeNet——CNN经典网络模型详解(pytorch实现)

    一.前言 论文地址:http://arxiv.org/abs/1602.07261 2014年,GoogLeNet和VGG是当年ImageNet挑战赛(ILSVRC14)的双雄,GoogLeNet获得 ...

  5. DenseNet——CNN经典网络模型详解(pytorch实现)

    一.概述 论文:Densely Connected Convolutional Networks 论文链接:https://arxiv.org/pdf/1608.06993.pdf 代码的github ...

  6. squeezenet论文详解

    根据原作者翻译,进行部分修改.标注,以方便查阅.文章仅作知识整理.分享,如有侵权请联系作者删除博文,谢谢! 论文地址:aqueezenet论文 SQUEEZENET: ALEXNET-级别精度50X ...

  7. MobileNet(v1、v2)——CNN经典网络模型详解(pytorch实现)

    在之前的文章中讲的AlexNet.VGG.GoogLeNet以及ResNet网络,它们都是传统卷积神经网络(都是使用的传统卷积层),缺点在于内存需求大.运算量大导致无法在移动设备以及嵌入式设备上运行. ...

  8. LeNet-5——CNN经典网络模型详解(pytorch实现)

    一.LeNet-5 这个是n多年前就有的一个CNN的经典结构,主要是用于手写字体的识别,也是刚入门需要学习熟悉的一个网络. 原论文地址 输入:32*32的手写字体图片,这些手写字体包含0~9数字,也就 ...

  9. AlexNet--CNN经典网络模型详解(pytorch实现)

    二.AlexNet 在imagenet上的图像分类challenge上大神Alex提出的alexnet网络结构模型赢得了2012届的冠军,振奋人心,利用CNN实现了图片分类,别人用传统的机器学习算法调 ...

最新文章

  1. C# TeeChart的一些用法
  2. 刚安装了Fedora32,尝尝鲜~,哈哈~~~
  3. NYOJ--21--bfs--三个水杯
  4. SpringMVC重定向传参
  5. SAP Spartacus Set Active BaseSite action执行的时间点 - Route路由触发方式
  6. Taro+react开发(79):taro生命周期setstate异步
  7. ORA-01658: 无法为表空间中段创建 INITIAL 区
  8. Ubuntu 开发者工具中心 Ubuntu Make
  9. sklearn.preprocessing.Imputer
  10. freemarker生成java代码,freeMarker之根据模板生成JAVA代码示例
  11. ArubaWLAN简明配置维护手册
  12. matlab画图实例_自定义函数
  13. SVM支持向量机-——希尔伯特空间解释
  14. 网易云音乐Android一面面经
  15. android 电视 vob格式转换,佳佳Android视频格式转换器
  16. 如何汇总100多个相同模板的电子表格
  17. insert overwrite出现Table insclause-0 has 9 columns, but query has 10 columns.
  18. ffmpeg的安装以及transform360插件的安装
  19. 微信小程序:wxml中写js语句的方法
  20. python工具——pypinyin 汉字转换拼音

热门文章

  1. java bufferedinputstream 编码_java中关于编码的问题(字符转换流及字符缓冲流 )
  2. 2012届华为校园招聘机试题
  3. 【工具】克隆题库(适用于所有以POJ2005-2017为模板的OJ平台)
  4. YoMail+ Worktile办公协同--颠覆传统邮件使用功能
  5. Jboss/Wildfly安装配置
  6. 1724: [Usaco2006 Nov]Fence Repair 切割木板( 贪心 )
  7. 软件测试作业5:计算下列代码片段的 Halstead 复杂度的11项内容
  8. Windows中的权限设置、文件压缩、文件加密、磁盘配额和卷影副本
  9. [python] Kmeans文本聚类算法+PAC降维+Matplotlib显示聚类图像
  10. [C/C++基础知识] main函数的参数argc和argv