class_docstr: The Object contextual representation head.
  
  Args:
      num_classes(int): The unique number of target classes.
      in_channels(tuple): The number of input channels.
      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.
class_docstr_tok: ["The","Object","contextual","representation","head",".","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","in_channels","(","tuple",")",":","The","number","of","input","channels",".","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","."]
code: def __init__(
      self,
      num_classes,
      in_channels,
      ocr_mid_channels=512,
      ocr_key_channels=256,
      ms_attention=False,
  ):
      super().__init__()
  
      self.num_classes = num_classes
      self.ms_attention = ms_attention
      self.spatial_gather = SpatialGatherBlock()
      self.spatial_ocr = SpatialOCRModule(
          ocr_mid_channels,
          ocr_key_channels,
          ocr_mid_channels,
          dropout_rate=0.05,
      )
  
      self.indices = [-2, -1] if len(in_channels) > 1 else [-1, -1]
  
      self.conv3x3_ocr = layers.ConvBNReLU(
          in_channels[self.indices[1]], ocr_mid_channels, 3, padding=1
      )
      self.cls_head = nn.Conv2D(ocr_mid_channels, self.num_classes, 1)
      self.aux_head = nn.Sequential(
          layers.ConvBNReLU(
              in_channels[self.indices[0]],
              in_channels[self.indices[0]],
              1,
          ),
          nn.Conv2D(in_channels[self.indices[0]], self.num_classes, 1),
      )
  
      self.init_weight()
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg import utils
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
label_desc: Use image node_id 1 to create a new OCRHead object from inherited base classes: nn with example: obj = OCRHead(num_classes, in_channels, ocr_mid_channels, ocr_key_channels, ms_attention)