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 __init__(
      self,
      feat_extractor: IntermediateLayerGetter,
      bin_thresh: float = 0.1,
      head_chans: int = 32,
      assume_straight_pages: bool = True,
      exportable: bool = False,
      cfg: Optional[Dict[str, Any]] = None,
      class_names: List[str] = [CLASS_NAME],
  ) -> None:
      super().__init__()
      self.class_names = class_names
      num_classes: int = len(self.class_names)
      self.cfg = cfg
      self.exportable = exportable
      self.assume_straight_pages = assume_straight_pages
  
      self.feat_extractor = feat_extractor
      # Identify the number of channels for the FPN initialization
      self.feat_extractor.eval()
      with torch.no_grad():
          in_shape = (3, 512, 512)
          out = self.feat_extractor(torch.zeros((1, *in_shape)))
          # Get the shapes of the extracted feature maps
          _shapes = [v.shape[1:] for _, v in out.items()]
          # Prepend the expected shapes of the first encoder
          _shapes = [
              (_shapes[0][0], in_shape[1] // 4, in_shape[2] // 4)
          ] + _shapes
      self.feat_extractor.train()
  
      self.fpn = LinkNetFPN(_shapes)
  
      self.classifier = nn.Sequential(
          nn.ConvTranspose2d(
              _shapes[0][0],
              head_chans,
              kernel_size=3,
              padding=1,
              output_padding=1,
              stride=2,
              bias=False,
          ),
          nn.BatchNorm2d(head_chans),
          nn.ReLU(inplace=True),
          nn.Conv2d(
              head_chans,
              head_chans,
              kernel_size=3,
              padding=1,
              bias=False,
          ),
          nn.BatchNorm2d(head_chans),
          nn.ReLU(inplace=True),
          nn.ConvTranspose2d(
              head_chans, num_classes, kernel_size=2, stride=2
          ),
      )
  
      self.postprocessor = LinkNetPostProcessor(
          assume_straight_pages=self.assume_straight_pages,
          bin_thresh=bin_thresh,
      )
  
      for n, m in self.named_modules():
          # Don't override the initialization of the backbone
          if n.startswith("feat_extractor."):
              continue
          if isinstance(m, (nn.Conv2d, nn.ConvTranspose2d)):
              nn.init.kaiming_normal_(
                  m.weight.data, mode="fan_out", nonlinearity="relu"
              )
              if m.bias is not None:
                  m.bias.data.zero_()
          elif isinstance(m, nn.BatchNorm2d):
              m.weight.data.fill_(1.0)
              m.bias.data.zero_()
  
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 to create a new LinkNet object from inherited base classes: nn, _LinkNet with example: obj = LinkNet(feat_extractor, bin_thresh, head_chans, assume_straight_pages, exportable, cfg, class_names)