class_docstr: LinkNet as described in `"LinkNet: Exploiting Encoder Representations for Efficient Semantic Segmentation"
  <https://arxiv.org/pdf/1707.03718.pdf>`_.
  
  Args:
  ----
      feature extractor: the backbone serving as feature extractor
      head_chans: number of channels in the head layers
      assume_straight_pages: if True, fit straight bounding boxes only
      exportable: onnx exportable returns only logits
      cfg: the configuration dict of the model
      class_names: list of class names
code: def forward(
      self,
      x: torch.Tensor,
      target: Optional[List[np.ndarray]] = None,
      return_model_output: bool = False,
      return_preds: bool = False,
      **kwargs: Any,
  ) -> Dict[str, Any]:
      feats = self.feat_extractor(x)
      logits = self.fpn([feats[str(idx)] for idx in range(len(feats))])
      logits = self.classifier(logits)
  
      out: Dict[str, Any] = {}
      if self.exportable:
          out["logits"] = logits
          return out
  
      if return_model_output or target is None or return_preds:
          prob_map = _bf16_to_float32(torch.sigmoid(logits))
      if return_model_output:
          out["out_map"] = prob_map
  
      if target is None or return_preds:
          # Post-process boxes
          out["preds"] = [
              dict(zip(self.class_names, preds))
              for preds in self.postprocessor(
                  prob_map.detach().cpu().permute((0, 2, 3, 1)).numpy()
              )
          ]
  
      if target is not None:
          loss = self.compute_loss(logits, target)
          out["loss"] = loss
  
      return out
  
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 2 for calling the LinkNet obj's underlying member method code with example usage: obj.forward(x, target, return_model_output, return_preds) and returns: out, out