Squeeze Net

1602_Squeeze Net

图:

img

img

网络描述:

Squeeze Net 发表于ICLR-2017,作者分别来自Berkeley和Stanford,Squeeze Net不是模型压缩技术,而是 “design strategies for CNN architectures with few parameters” 。 Squeeze Net是Han等提出的一种轻量且高效的CNN模型,它参数比AlexNet少50x,但模型性能(accuracy)与AlexNet接近。SqueezeNet的核心在于Fire module,Fire module 由两层构成,分别是squeeze层+expand层,如上图所示,squeeze层是一个1x1卷积核的卷积层,expand层是1x1和3x3卷积核的卷积层,expand层中,把1x1 和3x3 得到的feature map 进行concat。

特点,优点:

(1) 提出了新的网络架构Fire Module,通过减少参数来进行模型压缩

(2) 使用其他方法对提出的Squeeze Net模型进行进一步压缩,

(3) 对参数空间进行了探索,主要研究了压缩比和3∗3,3∗3卷积比例的影响

(4) 更高效的分布式训练,小模型参数小,网络通信量减少;

(5) 便于模型更新,模型小,客户端程序容易更新;

(6) 利于部署在特定硬件如FPGA,因为其内存受限。因此研究小模型是很有现实意义的。

其他方法:使用以下三个策略来减少Squeeze Net设计参数

1.使用1∗1卷积代替3∗3 卷积:参数减少为原来的1/9

2.减少输入通道数量:这一部分使用squeeze layers来实现

3.将池化层操作延后,可以给卷积层提供更大的激活图:更大的激活图保留了更多的信息,可以提供更高的分类准确率

代码:
keras实现:
def fire_module(x, fire_id, squeeze=16, expand=64):
    s_id = 'fire' + str(fire_id) + '/'

    if K.image_data_format() == 'channels_first':
        channel_axis = 1
    else:
        channel_axis = 3
    
    x = Convolution2D(squeeze, (1, 1), padding='valid', name=s_id + sq1x1)(x)
    x = Activation('relu', name=s_id + relu + sq1x1)(x)

    left = Convolution2D(expand, (1, 1), padding='valid', name=s_id + exp1x1)(x)
    left = Activation('relu', name=s_id + relu + exp1x1)(left)

    right = Convolution2D(expand, (3, 3), padding='same', name=s_id + exp3x3)(x)
    right = Activation('relu', name=s_id + relu + exp3x3)(right)

    x = concatenate([left, right], axis=channel_axis, name=s_id + 'concat')
    return x


# Original SqueezeNet from paper.
def SqueezeNet(include_top=True, weights='imagenet',
               input_tensor=None, input_shape=None,
               pooling=None,
               classes=1000):
    """Instantiates the SqueezeNet architecture.
    """
        
    if weights not in {
   'imagenet', None}:
        raise ValueError('The `weights` argument should be either '
                         '`None` (random initialization) or `imagenet` '
                         '(pre-training on ImageNet).')

    if weights == 'imagenet' and classes != 1000:
        raise ValueError('If using `weights` as imagenet with `include_top`'
                         ' as true, `classes` should be 1000')

    input_shape = _obtain_input_shape(input_shape,
                                      default_size=227,
                                      min_size=48,
                                      data_format=K.image_data_format
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值