code: def PSPNet(
      backbone_name="vgg16",
      input_shape=(384, 384, 3),
      classes=21,
      activation="softmax",
      weights=None,
      encoder_weights="imagenet",
      encoder_freeze=False,
      downsample_factor=8,
      psp_conv_filters=512,
      psp_pooling_type="avg",
      psp_use_batchnorm=True,
      psp_dropout=None,
      **kwargs,
  ):
      """PSPNet_ is a fully convolution neural network for image semantic segmentation
  
      Args:
          backbone_name: name of classification model used as feature
                  extractor to build segmentation model.
          input_shape: shape of input data/image ``(H, W, C)``.
              ``H`` and ``W`` should be divisible by ``6 * downsample_factor`` and **NOT** ``None``!
          classes: a number of classes for output (output shape - ``(h, w, classes)``).
          activation: name of one of ``keras.activations`` for last model layer
                  (e.g. ``sigmoid``, ``softmax``, ``linear``).
          weights: optional, path to model weights.
          encoder_weights: one of ``None`` (random initialization), ``imagenet`` (pre-training on ImageNet).
          encoder_freeze: if ``True`` set all layers of encoder (backbone model) as non-trainable.
          downsample_factor: one of 4, 8 and 16. Downsampling rate or in other words backbone depth
              to construct PSP module on it.
          psp_conv_filters: number of filters in ``Conv2D`` layer in each PSP block.
          psp_pooling_type: one of 'avg', 'max'. PSP block pooling type (maximum or average).
          psp_use_batchnorm: if ``True``, ``BatchNormalisation`` layer between ``Conv2D`` and ``Activation`` layers
                  is used.
          psp_dropout: dropout rate between 0 and 1.
  
      Returns:
          ``keras.models.Model``: **PSPNet**
  
      .. _PSPNet:
          https://arxiv.org/pdf/1612.01105.pdf
  
      """
  
      global backend, layers, models, keras_utils
      submodule_args = filter_keras_submodules(kwargs)
      backend, layers, models, keras_utils = get_submodules_from_kwargs(
          submodule_args
      )
  
      # control image input shape
      check_input_shape(input_shape, downsample_factor)
  
      backbone = Backbones.get_backbone(
          backbone_name,
          input_shape=input_shape,
          weights=encoder_weights,
          include_top=False,
          **kwargs,
      )
  
      feature_layers = Backbones.get_feature_layers(backbone_name, n=3)
  
      if downsample_factor == 16:
          psp_layer_idx = feature_layers[0]
      elif downsample_factor == 8:
          psp_layer_idx = feature_layers[1]
      elif downsample_factor == 4:
          psp_layer_idx = feature_layers[2]
      else:
          raise ValueError(
              "Unsupported factor - `{}`, Use 4, 8 or 16.".format(
                  downsample_factor
              )
          )
  
      model = build_psp(
          backbone,
          psp_layer_idx,
          pooling_type=psp_pooling_type,
          conv_filters=psp_conv_filters,
          use_batchnorm=psp_use_batchnorm,
          final_upsampling_factor=downsample_factor,
          classes=classes,
          activation=activation,
          dropout=psp_dropout,
      )
  
      # lock encoder weights for fine-tuning
      if encoder_freeze:
          freeze_model(backbone, **kwargs)
  
      # loading model weights
      if weights is not None:
          model.load_weights(weights)
  
      return model
  
file_path: segmentation_models/segmentation_models/models/pspnet.py
imports: from keras_applications import get_submodules_from_kwargs
  from ._common_blocks import Conv2dBn
  from ._utils import freeze_model, filter_keras_submodules
  from ..backbones.backbones_factory import Backbones
label_desc: Use image node_id 6 for calling a global function with example usage: PSPNet(backbone_name, input_shape, classes, activation, weights, encoder_weights, encoder_freeze, downsample_factor, psp_conv_filters, psp_pooling_type, psp_use_batchnorm, psp_dropout) and returns: model