Functions | |
def | preprocess_input (x, data_format=None) |
def | SEDenseNet (input_shape=None, depth=40, nb_dense_block=3, growth_rate=12, nb_filter=-1, nb_layers_per_block=-1, bottleneck=False, reduction=0.0, dropout_rate=0.0, weight_decay=1e-4, subsample_initial_block=False, include_top=True, weights=None, input_tensor=None, classes=10, activation='softmax') |
def | SEDenseNetImageNet121 (input_shape=None, bottleneck=True, reduction=0.5, dropout_rate=0.0, weight_decay=1e-4, include_top=True, weights=None, input_tensor=None, classes=1000, activation='N') |
def | SEDenseNetImageNet169 (input_shape=None, bottleneck=True, reduction=0.5, dropout_rate=0.0, weight_decay=1e-4, include_top=True, weights=None, input_tensor=None, classes=1000, activation='softmax') |
def | SEDenseNetImageNet201 (input_shape=None, bottleneck=True, reduction=0.5, dropout_rate=0.0, weight_decay=1e-4, include_top=True, weights=None, input_tensor=None, classes=1000, activation='softmax') |
def | SEDenseNetImageNet264 (input_shape=None, bottleneck=True, reduction=0.5, dropout_rate=0.0, weight_decay=1e-4, include_top=True, weights=None, input_tensor=None, classes=1000, activation='softmax') |
def | SEDenseNetImageNet161 (input_shape=None, bottleneck=True, reduction=0.5, dropout_rate=0.0, weight_decay=1e-4, include_top=True, weights=None, input_tensor=None, classes=1000, activation='softmax') |
def | __conv_block (ip, nb_filter, bottleneck=False, dropout_rate=None, weight_decay=1e-4) |
def | __dense_block (x, nb_layers, nb_filter, growth_rate, bottleneck=False, dropout_rate=None, weight_decay=1e-4, grow_nb_filters=True, return_concat_list=False) |
def | __transition_block (ip, nb_filter, compression=1.0, weight_decay=1e-4) |
def | __create_dense_net (nb_classes, img_input, include_top, depth=40, nb_dense_block=3, growth_rate=12, nb_filter=-1, nb_layers_per_block=-1, bottleneck=False, reduction=0.0, dropout_rate=None, weight_decay=1e-4, subsample_initial_block=False, activation='softmax') |
DenseNet models for Keras. # Reference - [Densely Connected Convolutional Networks](https://arxiv.org/pdf/1608.06993.pdf) - [The One Hundred Layers Tiramisu: Fully Convolutional DenseNets for Semantic Segmentation](https://arxiv.org/pdf/1611.09326.pdf)
|
private |
Apply BatchNorm, Relu, 3x3 Conv2D, optional bottleneck block and dropout Args: ip: Input keras tensor nb_filter: number of filters bottleneck: add bottleneck block dropout_rate: dropout rate weight_decay: weight decay factor Returns: keras tensor with batch_norm, relu and convolution2d added (optional bottleneck)
Definition at line 260 of file se_densenet.py.
|
private |
Build the DenseNet model Args: nb_classes: number of classes img_input: tuple of shape (channels, rows, columns) or (rows, columns, channels) include_top: flag to include the final Dense layer depth: number or layers nb_dense_block: number of dense blocks to add to end (generally = 3) growth_rate: number of filters to add per dense block nb_filter: initial number of filters. Default -1 indicates initial number of filters is 2 * growth_rate nb_layers_per_block: number of layers in each dense block. Can be a -1, positive integer or a list. If -1, calculates nb_layer_per_block from the depth of the network. If positive integer, a set number of layers per dense block. If list, nb_layer is used as provided. Note that list size must be (nb_dense_block + 1) bottleneck: add bottleneck blocks reduction: reduction factor of transition blocks. Note : reduction value is inverted to compute compression dropout_rate: dropout rate weight_decay: weight decay rate subsample_initial_block: Set to True to subsample the initial convolution and add a MaxPool2D before the dense blocks are added. subsample_initial: activation: Type of activation at the top layer. Can be one of 'softmax' or 'sigmoid'. Note that if sigmoid is used, classes must be 1. Returns: keras tensor with nb_layers of conv_block appended
Definition at line 354 of file se_densenet.py.
|
private |
Build a dense_block where the output of each conv_block is fed to subsequent ones Args: x: keras tensor nb_layers: the number of layers of conv_block to append to the model. nb_filter: number of filters growth_rate: growth rate bottleneck: bottleneck block dropout_rate: dropout rate weight_decay: weight decay factor grow_nb_filters: flag to decide to allow number of filters to grow return_concat_list: return the list of feature maps along with the actual output Returns: keras tensor with nb_layers of conv_block appended
Definition at line 291 of file se_densenet.py.
|
private |
Apply BatchNorm, Relu 1x1, Conv2D, optional compression, dropout and Maxpooling2D Args: ip: keras tensor nb_filter: number of filters compression: calculated as 1 - reduction. Reduces the number of feature maps in the transition block. dropout_rate: dropout rate weight_decay: weight decay factor Returns: keras tensor, after applying batch_norm, relu-conv, dropout, maxpool
Definition at line 327 of file se_densenet.py.
def se_densenet.preprocess_input | ( | x, | |
data_format = None |
|||
) |
Preprocesses a tensor encoding a batch of images. # Arguments x: input Numpy tensor, 4D. data_format: data format of the image tensor. # Returns Preprocessed tensor.
Definition at line 31 of file se_densenet.py.
def se_densenet.SEDenseNet | ( | input_shape = None , |
|
depth = 40 , |
|||
nb_dense_block = 3 , |
|||
growth_rate = 12 , |
|||
nb_filter = -1 , |
|||
nb_layers_per_block = -1 , |
|||
bottleneck = False , |
|||
reduction = 0.0 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
subsample_initial_block = False , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 10 , |
|||
activation = 'softmax' |
|||
) |
Instantiate the SE DenseNet architecture # Arguments input_shape: optional shape tuple, only to be specified if `include_top` is False (otherwise the input shape has to be `(32, 32, 3)` (with `channels_last` dim ordering) or `(3, 32, 32)` (with `channels_first` dim ordering). It should have exactly 3 inputs channels, and width and height should be no smaller than 8. E.g. `(200, 200, 3)` would be one valid value. depth: number or layers in the DenseNet nb_dense_block: number of dense blocks to add to end (generally = 3) growth_rate: number of filters to add per dense block nb_filter: initial number of filters. -1 indicates initial number of filters is 2 * growth_rate nb_layers_per_block: number of layers in each dense block. Can be a -1, positive integer or a list. If -1, calculates nb_layer_per_block from the network depth. If positive integer, a set number of layers per dense block. If list, nb_layer is used as provided. Note that list size must be (nb_dense_block + 1) bottleneck: flag to add bottleneck blocks in between dense blocks reduction: reduction factor of transition blocks. Note : reduction value is inverted to compute compression. dropout_rate: dropout rate weight_decay: weight decay rate subsample_initial_block: Set to True to subsample the initial convolution and add a MaxPool2D before the dense blocks are added. include_top: whether to include the fully-connected layer at the top of the network. weights: one of `None` (random initialization) or 'imagenet' (pre-training on ImageNet).. input_tensor: optional Keras tensor (i.e. output of `layers.Input()`) to use as image input for the model. classes: optional number of classes to classify images into, only to be specified if `include_top` is True, and if no `weights` argument is specified. activation: Type of activation at the top layer. Can be one of 'softmax' or 'sigmoid'. Note that if sigmoid is used, classes must be 1. # Returns A Keras model instance.
Definition at line 86 of file se_densenet.py.
def se_densenet.SEDenseNetImageNet121 | ( | input_shape = None , |
|
bottleneck = True , |
|||
reduction = 0.5 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 1000 , |
|||
activation = 'N' |
|||
) |
Definition at line 184 of file se_densenet.py.
def se_densenet.SEDenseNetImageNet161 | ( | input_shape = None , |
|
bottleneck = True , |
|||
reduction = 0.5 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 1000 , |
|||
activation = 'softmax' |
|||
) |
Definition at line 252 of file se_densenet.py.
def se_densenet.SEDenseNetImageNet169 | ( | input_shape = None , |
|
bottleneck = True , |
|||
reduction = 0.5 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 1000 , |
|||
activation = 'softmax' |
|||
) |
Definition at line 201 of file se_densenet.py.
def se_densenet.SEDenseNetImageNet201 | ( | input_shape = None , |
|
bottleneck = True , |
|||
reduction = 0.5 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 1000 , |
|||
activation = 'softmax' |
|||
) |
Definition at line 218 of file se_densenet.py.
def se_densenet.SEDenseNetImageNet264 | ( | input_shape = None , |
|
bottleneck = True , |
|||
reduction = 0.5 , |
|||
dropout_rate = 0.0 , |
|||
weight_decay = 1e-4 , |
|||
include_top = True , |
|||
weights = None , |
|||
input_tensor = None , |
|||
classes = 1000 , |
|||
activation = 'softmax' |
|||
) |
Definition at line 235 of file se_densenet.py.