class_docstr: The OCRNet implementation based on PaddlePaddle.
  The original article refers to
      Yuan, Yuhui, et al. "Object-Contextual Representations for Semantic Segmentation"
      (https://arxiv.org/pdf/1909.11065.pdf)
  Args:
      num_classes (int): The unique number of target classes.
      backbone_indices (list): A list indicates the indices of output of backbone.
          It can be either one or two values, if two values, the first index will be taken as
          a deep-supervision feature in auxiliary layer; the second one will be taken as
          input of pixel representation. If one value, it is taken by both above.
      ocr_mid_channels (int, optional): The number of middle channels in OCRHead. Default: 512.
      ocr_key_channels (int, optional): The number of key channels in ObjectAttentionBlock. Default: 256.
      align_corners (bool): An argument of F.interpolate. It should be set to False when the output size of feature
          is even, e.g. 1024x512, otherwise it is True, e.g. 769x769.  Default: False.
      pretrained (str, optional): The path or url of pretrained model. Default: None.
code: def __init__(
      self,
      num_classes: int = 21,
      backbone_indices: List[int] = [0],
      ocr_mid_channels: int = 512,
      ocr_key_channels: int = 256,
      align_corners: bool = False,
      pretrained: str = None,
  ):
      super(OCRNetHRNetW18, self).__init__()
      self.backbone = HRNet_W18()
      self.backbone_indices = backbone_indices
      in_channels = [
          self.backbone.feat_channels[i] for i in backbone_indices
      ]
      self.head = OCRHead(
          num_classes=num_classes,
          in_channels=in_channels,
          ocr_mid_channels=ocr_mid_channels,
          ocr_key_channels=ocr_key_channels,
      )
      self.align_corners = align_corners
      self.transforms = T.Compose([T.Normalize()])
  
      if pretrained is not None:
          model_dict = paddle.load(pretrained)
          self.set_dict(model_dict)
          print("load custom parameters success")
  
      else:
          checkpoint = os.path.join(
              self.directory, "ocrnet_hrnetw18.pdparams"
          )
          model_dict = paddle.load(checkpoint)
          self.set_dict(model_dict)
          print("load pretrained parameters success")
  
imports: import os
  from typing import List
  import paddle
  import numpy
  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
  import ocrnet_hrnetw18_voc.layers
  from ocrnet_hrnetw18_voc.hrnet import HRNet_W18
label_desc: Use image node_id 1 to create a new OCRNetHRNetW18 object from inherited base classes: nn with example: obj = OCRNetHRNetW18(num_classes, backbone_indices, ocr_mid_channels, ocr_key_channels, align_corners, pretrained)