class_docstr: The ANNHead implementation.
  
  It mainly consists of AFNB and APNB modules.
  
  Args:
      num_classes (int): The unique number of target classes.
      backbone_indices (tuple): Two values in the tuple indicate the indices of output of backbone.
          The first index will be taken as low-level features; the second one will be
          taken as high-level features in AFNB module. Usually backbone consists of four
          downsampling stage, such as ResNet, and return an output of each stage. If it is (2, 3),
          it means taking feature map of the third stage and the fourth stage in backbone.
      backbone_channels (tuple): The same length with "backbone_indices". It indicates the channels of corresponding index.
      key_value_channels (int): The key and value channels of self-attention map in both AFNB and APNB modules.
      inter_channels (int): Both input and output channels of APNB modules.
      psp_size (tuple): The out size of pooled feature maps.
      enable_auxiliary_loss (bool, optional): A bool value indicates whether adding auxiliary loss. Default: False
code: def __init__(
      self,
      num_classes: int,
      backbone_indices: Tuple[int],
      backbone_channels: Tuple[int],
      key_value_channels: int,
      inter_channels: int,
      psp_size: Tuple[int],
      enable_auxiliary_loss: bool = False,
  ):
      super().__init__()
  
      low_in_channels = backbone_channels[0]
      high_in_channels = backbone_channels[1]
  
      self.fusion = AFNB(
          low_in_channels=low_in_channels,
          high_in_channels=high_in_channels,
          out_channels=high_in_channels,
          key_channels=key_value_channels,
          value_channels=key_value_channels,
          dropout_prob=0.05,
          repeat_sizes=([1]),
          psp_size=psp_size,
      )
  
      self.context = nn.Sequential(
          layers.ConvBNReLU(
              in_channels=high_in_channels,
              out_channels=inter_channels,
              kernel_size=3,
              padding=1,
          ),
          APNB(
              in_channels=inter_channels,
              out_channels=inter_channels,
              key_channels=key_value_channels,
              value_channels=key_value_channels,
              dropout_prob=0.05,
              repeat_sizes=([1]),
              psp_size=psp_size,
          ),
      )
  
      self.cls = nn.Conv2D(
          in_channels=inter_channels,
          out_channels=num_classes,
          kernel_size=1,
      )
      self.auxlayer = layers.AuxLayer(
          in_channels=low_in_channels,
          inter_channels=low_in_channels // 2,
          out_channels=num_classes,
          dropout_prob=0.05,
      )
  
      self.backbone_indices = backbone_indices
      self.enable_auxiliary_loss = enable_auxiliary_loss
  
imports: import os
  from typing import Union, List, Tuple
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddlehub.module.module import moduleinfo
  import paddlehub.vision.segmentation_transforms
  from paddlehub.module.cv_module import ImageSegmentationModule
  from ann_resnet50_voc.resnet import ResNet50_vd
  import ann_resnet50_voc.layers
label_desc: Use image node_id 1 to create a new ANNHead object from inherited base classes: nn with example: obj = ANNHead(num_classes, backbone_indices, backbone_channels, key_value_channels, inter_channels, psp_size, enable_auxiliary_loss)