code: def _linknet(
      arch: str,
      pretrained: bool,
      backbone_fn: Callable[[bool], nn.Module],
      fpn_layers: List[str],
      pretrained_backbone: bool = True,
      ignore_keys: Optional[List[str]] = None,
      **kwargs: Any,
  ) -> LinkNet:
      pretrained_backbone = pretrained_backbone and not pretrained
  
      # Build the feature extractor
      backbone = backbone_fn(pretrained_backbone)
      feat_extractor = IntermediateLayerGetter(
          backbone,
          {
              layer_name: str(idx)
              for idx, layer_name in enumerate(fpn_layers)
          },
      )
      if not kwargs.get("class_names", None):
          kwargs["class_names"] = default_cfgs[arch].get(
              "class_names", [CLASS_NAME]
          )
      else:
          kwargs["class_names"] = sorted(kwargs["class_names"])
  
      # Build the model
      model = LinkNet(feat_extractor, cfg=default_cfgs[arch], **kwargs)
      # Load pretrained parameters
      if pretrained:
          # The number of class_names is not the same as the number of classes in the pretrained model =>
          # remove the layer weights
          _ignore_keys = (
              ignore_keys
              if kwargs["class_names"]
              != default_cfgs[arch].get("class_names", [CLASS_NAME])
              else None
          )
          load_pretrained_params(
              model, default_cfgs[arch]["url"], ignore_keys=_ignore_keys
          )
  
      return model
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple
  import numpy
  import torch
  from torch import nn
  from torch.nn import functional
  from torchvision.models._utils import IntermediateLayerGetter
  from doctr.file_utils import CLASS_NAME
  from doctr.models.classification import resnet18, resnet34, resnet50
  from ...utils import _bf16_to_float32, load_pretrained_params
  from .base import LinkNetPostProcessor, _LinkNet
label_desc: Use image node_id 1 for calling a global function with example usage: _linknet(arch, pretrained, backbone_fn, fpn_layers, pretrained_backbone, ignore_keys) and returns: model