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, andActivationlayers and can be finished by either aMaxPooling2D, aAveragePooling2Dor aUpSampling2Dlayer.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
maxor 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()withnfilter 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