alexnet_base.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:FaceDetection 作者: youssefhb 项目源码 文件源码
def conv2D_lrn2d(x, nb_filter, nb_row, nb_col,
                 padding='same', strides=(1, 1),
                 activation='relu', LRN2D_norm=True, bias_initializer='zeros',kernel_initializer='glorot_uniform',
                 weight_decay=WEIGHT_DECAY, data_format="channels_first",name='conv'):
    '''

        Info:
            Function taken from the Inceptionv3.py script keras github


            Utility function to apply to a tensor a module Convolution + lrn2d
            with optional weight decay (L2 weight regularization).
    '''
    if weight_decay:
        W_regularizer = regularizers.l2(weight_decay)
        b_regularizer = regularizers.l2(weight_decay)
    else:
        W_regularizer = None
        b_regularizer = None


    x = Conv2D(nb_filter, (nb_row, nb_col), bias_regularizer=b_regularizer,
                            activation=activation,
                            data_format="channels_first",
                            padding=padding,
                            strides=strides,
                            bias_initializer='zeros',kernel_initializer='glorot_uniform',
                            kernel_regularizer=W_regularizer, use_bias=False,name=name)(x)


    x = ZeroPadding2D(padding=(1, 1), data_format="channels_first")(x)

    if LRN2D_norm:

        x = LRN2D(alpha=ALPHA, beta=BETA)(x)
        x = ZeroPadding2D(padding=(1, 1), data_format="channels_first")(x)

    return x
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号