code: def FPNBlock(pyramid_filters, stage):
      conv0_name = "fpn_stage_p{}_pre_conv".format(stage)
      conv1_name = "fpn_stage_p{}_conv".format(stage)
      add_name = "fpn_stage_p{}_add".format(stage)
      up_name = "fpn_stage_p{}_upsampling".format(stage)
  
      channels_axis = (
          3 if backend.image_data_format() == "channels_last" else 1
      )
  
      def wrapper(input_tensor, skip):
          # if input tensor channels not equal to pyramid channels
          # we will not be able to sum input tensor and skip
          # so add extra conv layer to transform it
          input_filters = backend.int_shape(input_tensor)[channels_axis]
          if input_filters != pyramid_filters:
              input_tensor = layers.Conv2D(
                  filters=pyramid_filters,
                  kernel_size=(1, 1),
                  kernel_initializer="he_uniform",
                  name=conv0_name,
              )(input_tensor)
  
          skip = layers.Conv2D(
              filters=pyramid_filters,
              kernel_size=(1, 1),
              kernel_initializer="he_uniform",
              name=conv1_name,
          )(skip)
  
          x = layers.UpSampling2D((2, 2), name=up_name)(input_tensor)
          x = layers.Add(name=add_name)([x, skip])
  
          return x
  
      return wrapper
  
file_path: segmentation_models/segmentation_models/models/fpn.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 4 for calling a global function with example usage: FPNBlock(pyramid_filters, stage) and returns: wrapper, x