code: def build_keras_model(weights_path: str = None, backbone_name="vgg"):
      inputs = keras.layers.Input((None, None, 3))
  
      if backbone_name == "vgg":
          s1, s2, s3, s4 = build_vgg_backbone(inputs)
      elif "efficientnet" in backbone_name.lower():
          s1, s2, s3, s4 = build_efficientnet_backbone(
              inputs=inputs,
              backbone_name=backbone_name,
              imagenet=weights_path is None,
          )
      else:
          raise NotImplementedError
  
      s5 = keras.layers.MaxPooling2D(
          pool_size=3,
          strides=1,
          padding="same",
          name="basenet.slice5.0",
      )(s4)
      s5 = keras.layers.Conv2D(
          1024,
          kernel_size=(3, 3),
          padding="same",
          strides=1,
          dilation_rate=6,
          name="basenet.slice5.1",
      )(s5)
      s5 = keras.layers.Conv2D(
          1024,
          kernel_size=1,
          strides=1,
          padding="same",
          name="basenet.slice5.2",
      )(s5)
  
      y = keras.layers.Concatenate()([s5, s4])
      y = upconv(y, n=1, filters=512)
      y = UpsampleLike()([y, s3])
      y = keras.layers.Concatenate()([y, s3])
      y = upconv(y, n=2, filters=256)
      y = UpsampleLike()([y, s2])
      y = keras.layers.Concatenate()([y, s2])
      y = upconv(y, n=3, filters=128)
      y = UpsampleLike()([y, s1])
      y = keras.layers.Concatenate()([y, s1])
      features = upconv(y, n=4, filters=64)
  
      y = keras.layers.Conv2D(
          filters=32,
          kernel_size=3,
          strides=1,
          padding="same",
          name="conv_cls.0",
      )(features)
      y = keras.layers.Activation("relu", name="conv_cls.1")(y)
      y = keras.layers.Conv2D(
          filters=32,
          kernel_size=3,
          strides=1,
          padding="same",
          name="conv_cls.2",
      )(y)
      y = keras.layers.Activation("relu", name="conv_cls.3")(y)
      y = keras.layers.Conv2D(
          filters=16,
          kernel_size=3,
          strides=1,
          padding="same",
          name="conv_cls.4",
      )(y)
      y = keras.layers.Activation("relu", name="conv_cls.5")(y)
      y = keras.layers.Conv2D(
          filters=16,
          kernel_size=1,
          strides=1,
          padding="same",
          name="conv_cls.6",
      )(y)
      y = keras.layers.Activation("relu", name="conv_cls.7")(y)
      y = keras.layers.Conv2D(
          filters=2,
          kernel_size=1,
          strides=1,
          padding="same",
          name="conv_cls.8",
      )(y)
      if backbone_name != "vgg":
          y = keras.layers.Activation("sigmoid")(y)
      model = keras.models.Model(inputs=inputs, outputs=y)
      if weights_path is not None:
          if weights_path.endswith(".h5"):
              model.load_weights(weights_path)
          elif weights_path.endswith(".pth"):
              assert (
                  backbone_name == "vgg"
              ), "PyTorch weights only allowed with VGG backbone."
              load_torch_weights(model=model, weights_path=weights_path)
          else:
              raise NotImplementedError(
                  f"Cannot load weights from {weights_path}"
              )
      return model
  
imports: import typing
  import cv2
  import numpy
  import tensorflow
  import efficientnet.tfkeras
  from tensorflow import keras
  from .None import tools
label_desc: Use image node_id 11 for calling a global function with example usage: build_keras_model(weights_path, backbone_name) and returns: model