code: def build_psp(
      backbone,
      psp_layer_idx,
      pooling_type="avg",
      conv_filters=512,
      use_batchnorm=True,
      final_upsampling_factor=8,
      classes=21,
      activation="softmax",
      dropout=None,
  ):
      input_ = backbone.input
      x = (
          backbone.get_layer(name=psp_layer_idx).output
          if isinstance(psp_layer_idx, str)
          else backbone.get_layer(index=psp_layer_idx).output
      )
  
      # build spatial pyramid
      x1 = SpatialContextBlock(
          1, conv_filters, pooling_type, use_batchnorm
      )(x)
      x2 = SpatialContextBlock(
          2, conv_filters, pooling_type, use_batchnorm
      )(x)
      x3 = SpatialContextBlock(
          3, conv_filters, pooling_type, use_batchnorm
      )(x)
      x6 = SpatialContextBlock(
          6, conv_filters, pooling_type, use_batchnorm
      )(x)
  
      # aggregate spatial pyramid
      concat_axis = (
          3 if backend.image_data_format() == "channels_last" else 1
      )
      x = layers.Concatenate(axis=concat_axis, name="psp_concat")(
          [x, x1, x2, x3, x6]
      )
      x = Conv1x1BnReLU(
          conv_filters, use_batchnorm, name="aggregation"
      )(x)
  
      # model regularization
      if dropout is not None:
          x = layers.SpatialDropout2D(dropout, name="spatial_dropout")(
              x
          )
  
      # model head
      x = layers.Conv2D(
          filters=classes,
          kernel_size=(3, 3),
          padding="same",
          kernel_initializer="glorot_uniform",
          name="final_conv",
      )(x)
  
      x = layers.UpSampling2D(
          final_upsampling_factor,
          name="final_upsampling",
          interpolation="bilinear",
      )(x)
      x = layers.Activation(activation, name=activation)(x)
  
      model = models.Model(input_, x)
  
      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 5 for calling a global function with example usage: build_psp(backbone, psp_layer_idx, pooling_type, conv_filters, use_batchnorm, final_upsampling_factor, classes, activation, dropout) and returns: model