Skip to content

VggEncoderDecoder

VggEncoderDecoder class

dlf.models.vgg_encoder_decoder.VggEncoderDecoder(
    input_shape,
    num_classes,
    use_skip_layers=True,
    use_transposed_conv=True,
    model_weights=None,
    summary=False,
    optimizer=None,
    loss=None,
    **kwargs
)

A SegNet like implementation of an Encoder-Decoder using VGG16.

Compared to SegNet this implementation differs by using a 2D UpSampling layer (bilinear or nearest). Optional you can use the skip connections

SegNet: https://arxiv.org/abs/1511.00561

Aliases:

  • VggEncoderDecoder
  • vgg_encoder_decoder

Args:

  • input_shape: tuple(int, int , int). Input shape of this network
  • num_classes: int. Number of classes
  • use_skip_layers: bool, optional. If true the network uses skip layers. Defaults to True.
  • use_transposed_conv: bool, optional. If true a transposed convolution instead of UpSample2D is used. Defaults to True.
  • model_weights: str, optional. Path to the pretrained model weights. Defaults to None.
  • summary: bool, optional. If true a summary of the model will be printed to stdout. Defaults to False.
  • optimizer: list of dict, optional. Name of optimizer used for training.
  • loss: list of dict, optional. List of loss objects to build for this model. Defaults to None.

Returns

A Keras model instance.

YAML Configuration

model:
    vgg_encoder_decoder:
        input_shape:
            - 512
            - 512
            - 3
        num_classes: &num_classes 7
        use_skip_layers: True
        use_transposed_conv: True
        model_weights: None
        summary: True
        optimizer:
            - Adam:
                learning_rate: 0.00001
        loss:
            - SparseCategoricalCrossentropyIgnore:
                num_classes: *num_classes
                from_logits: False