GoogLeNet之InceptionV2神经网络简介与代码实战

1.介绍

Inception V2是Inception家族的一个中间件产物,具体可以参见论文Rethinking the Inception Architecture for Computer Vision中。

 

2.模型结构

GoogLeNet之InceptionV2神经网络简介与代码实战_第1张图片

                                                             InceptionV1子结构   

GoogLeNet之InceptionV2神经网络简介与代码实战_第2张图片

                                                                   InceptionV2子结构 

 

3.模型特点

Inception V2相比Inception V1进行了如下改进:

1.使用Batch Normalization,加快模型训练速度;

2.使用两个3x3的卷积代替5x5的大卷积,降低了参数数量并减轻了过拟合;

3.去除Dropout并减轻L2正则化(因BN已起到正则化的作用);

 

4.代码实现 keras

def Conv2d(x, nb_filter,kernel_size, padding='same',strides=(1,1)):
    x = Conv2D(nb_filter,kernel_size,padding=padding,strides=strides)(x)
    x = BatchNormalization(axis=3)(x)
    x = Activation('relu')(x)
    return x


def Inception(x,nb_filter=[128,128,192,32,96,64]):
    branch1x1 = Conv2d(x,nb_filter[0],(1,1), padding='same',strides=(1,1))
 
    branch3x3 = Conv2d(x,nb_filter[1],(1,1), padding='same',strides=(1,1))
    branch3x3 = Conv2d(branch3x3,nb_filter[2],(3,3), padding='same',strides=(1,1))
 
    branch5x5 = Conv2d(x,nb_filter[3],(1,1), padding='same',strides=(1,1))
    branch5x5 = Conv2d(branch5x5,nb_filter[4],(3,3), padding='same',strides=(1,1))
    branch5x5 = Conv2d(branch5x5,nb_filter[4],(3,3), padding='same',strides=(1,1))
 
    branchpool = MaxPooling2D(pool_size=(3,3),strides=(1,1),padding='same')(x)
    branchpool = Conv2d(branchpool,nb_filter[5],(1,1),padding='same',strides=(1,1))
 
    x = concatenate([branch1x1,branch3x3,branch5x5,branchpool],axis=3)
 
    return x

 

你可能感兴趣的:(深度学习CNN基本模型,深度学习CNN基本模型)