diktya.blocks¶
Note
The functions in this module are espacially usefull together
with the sequential
function.
-
conv2d_block
(n, filters=3, depth=1, border='same', activation='relu', batchnorm=True, pooling=None, up=False, subsample=1)[source]¶ 2D-Convolutional block consisting of possible muliple repetitions of
Convolution2D
,BatchNormalization
, andActivation
layers and can be finished by either aMaxPooling2D
, aAveragePooling2D
or aUpSampling2D
layer.Parameters: - n – number of filters of the convolution layer
- filters – shape of the filters are
(filters, filters)
- depth – repeat the convolutional, batchnormalization, activation blocks this many times
- border – border_mode of the Convolution2D layer
- activation – name or activation or a advanced Activation layer.
- batchnorm – use batchnorm layer if true. If it is an integer it indicates the batchnorm mode.
- pooling – if given, either
max
or avg for MaxPooling2D or AveragePooling2D - up – if true, use a UpSampling2D as last layer. Cannot be true if also pooling is given.
Returns: A nested list containing the layers.
-
resnet
(n, filters=3, activation='relu')[source]¶ A ResNet block. If the number of filter maps is not equal to
n
, aconv2d_block()
withn
filter maps is added.Parameters: - n – number of filters
- filters – size of the conv filters
Returns: A function that takes a keras tensor as input and runs the resnet block