Apply BatchNorm, Relu 3x3Conv2D, optional dropout :param x: Input keras network :param concat_axis: int -- index of contatenate axis :param nb_filter: int -- number of filters :param dropout_rate: int -- dropout rate :param weight_decay: int -- weight decay factor :returns:
(x, concat_axis, nb_filter,
dropout_rate=None, weight_decay=1E-4)
| 10 | |
| 11 | |
| 12 | def conv_factory(x, concat_axis, nb_filter, |
| 13 | dropout_rate=None, weight_decay=1E-4): |
| 14 | """Apply BatchNorm, Relu 3x3Conv2D, optional dropout |
| 15 | |
| 16 | :param x: Input keras network |
| 17 | :param concat_axis: int -- index of contatenate axis |
| 18 | :param nb_filter: int -- number of filters |
| 19 | :param dropout_rate: int -- dropout rate |
| 20 | :param weight_decay: int -- weight decay factor |
| 21 | |
| 22 | :returns: keras network with b_norm, relu and Conv2D added |
| 23 | :rtype: keras network |
| 24 | """ |
| 25 | |
| 26 | x = BatchNormalization(axis=concat_axis, |
| 27 | gamma_regularizer=l2(weight_decay), |
| 28 | beta_regularizer=l2(weight_decay))(x) |
| 29 | x = Activation('relu')(x) |
| 30 | x = Conv2D(nb_filter, (3, 3), |
| 31 | kernel_initializer="he_uniform", |
| 32 | padding="same", |
| 33 | use_bias=False, |
| 34 | kernel_regularizer=l2(weight_decay))(x) |
| 35 | if dropout_rate: |
| 36 | x = Dropout(dropout_rate)(x) |
| 37 | |
| 38 | return x |
| 39 | |
| 40 | |
| 41 | def transition(x, concat_axis, nb_filter, |
no outgoing calls
no test coverage detected