code: def _linknet(
      arch: str,
      pretrained: bool,
      backbone_fn,
      fpn_layers: List[str],
      pretrained_backbone: bool = True,
      input_shape: Optional[Tuple[int, int, int]] = None,
      **kwargs: Any,
  ) -> LinkNet:
      pretrained_backbone = pretrained_backbone and not pretrained
  
      # Patch the config
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["input_shape"] = (
          input_shape or default_cfgs[arch]["input_shape"]
      )
      if not kwargs.get("class_names", None):
          kwargs["class_names"] = _cfg.get("class_names", [CLASS_NAME])
      else:
          kwargs["class_names"] = sorted(kwargs["class_names"])
  
      # Feature extractor
      feat_extractor = IntermediateLayerGetter(
          backbone_fn(
              pretrained=pretrained_backbone,
              include_top=False,
              input_shape=_cfg["input_shape"],
          ),
          fpn_layers,
      )
  
      # Build the model
      model = LinkNet(feat_extractor, cfg=_cfg, **kwargs)
      # Load pretrained parameters
      if pretrained:
          load_pretrained_params(model, _cfg["url"])
  
      return model
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import Model, Sequential, layers
  from doctr.file_utils import CLASS_NAME
  from doctr.models.classification import resnet18, resnet34, resnet50
  from doctr.models.utils import IntermediateLayerGetter, _bf16_to_float32, conv_sequence, load_pretrained_params
  from doctr.utils.repr import NestedObject
  from .base import LinkNetPostProcessor, _LinkNet
label_desc: Use image node_id 2 for calling a global function with example usage: _linknet(arch, pretrained, backbone_fn, fpn_layers, pretrained_backbone, input_shape) and returns: model