class_docstr: Side-Aware Boundary Localization (SABL) for RoI-Head.
  
  Side-Aware features are extracted by conv layers
  with an attention mechanism.
  Boundary Localization with Bucketing and Bucketing Guided Rescoring
  are implemented in BucketingBBoxCoder.
  
  Please refer to https://arxiv.org/abs/1912.04260 for more details.
  
  Args:
      cls_in_channels (int): Input channels of cls RoI feature.             Defaults to 256.
      reg_in_channels (int): Input channels of reg RoI feature.             Defaults to 256.
      roi_feat_size (int): Size of RoI features. Defaults to 7.
      reg_feat_up_ratio (int): Upsample ratio of reg features.             Defaults to 2.
      reg_pre_kernel (int): Kernel of 2D conv layers before             attention pooling. Defaults to 3.
      reg_post_kernel (int): Kernel of 1D conv layers after             attention pooling. Defaults to 3.
      reg_pre_num (int): Number of pre convs. Defaults to 2.
      reg_post_num (int): Number of post convs. Defaults to 1.
      num_classes (int): Number of classes in dataset. Defaults to 80.
      cls_out_channels (int): Hidden channels in cls fcs. Defaults to 1024.
      reg_offset_out_channels (int): Hidden and output channel             of reg offset branch. Defaults to 256.
      reg_cls_out_channels (int): Hidden and output channel             of reg cls branch. Defaults to 256.
      num_cls_fcs (int): Number of fcs for cls branch. Defaults to 1.
      num_reg_fcs (int): Number of fcs for reg branch.. Defaults to 0.
      reg_class_agnostic (bool): Class agnostic regression or not.             Defaults to True.
      norm_cfg (dict): Config of norm layers. Defaults to None.
      bbox_coder (dict): Config of bbox coder. Defaults 'BucketingBBoxCoder'.
      loss_cls (dict): Config of classification loss.
      loss_bbox_cls (dict): Config of classification loss for bbox branch.
      loss_bbox_reg (dict): Config of regression loss for bbox branch.
      init_cfg (dict or list[dict], optional): Initialization config dict.
          Defaults to None.
class_docstr_tok: ["Side-Aware","Boundary","Localization","(","SABL",")","for","RoI-Head",".","Side-Aware","features","are","extracted","by","conv","layers","with","an","attention","mechanism",".","Boundary","Localization","with","Bucketing","and","Bucketing","Guided","Rescoring","are","implemented","in","BucketingBBoxCoder",".","Please","refer","to","https",":","\/\/arxiv.org\/abs\/1912.04260","for","more","details",".","Args",":","cls_in_channels","(","int",")",":","Input","channels","of","cls","RoI","feature",".","Defaults","to","256.","reg_in_channels","(","int",")",":","Input","channels","of","reg","RoI","feature",".","Defaults","to","256.","roi_feat_size","(","int",")",":","Size","of","RoI","features",".","Defaults","to","7.","reg_feat_up_ratio","(","int",")",":","Upsample","ratio","of","reg","features",".","Defaults","to","2.","reg_pre_kernel","(","int",")",":","Kernel","of","2D","conv","layers","before","attention","pooling",".","Defaults","to","3.","reg_post_kernel","(","int",")",":","Kernel","of","1D","conv","layers","after","attention","pooling",".","Defaults","to","3.","reg_pre_num","(","int",")",":","Number","of","pre","convs",".","Defaults","to","2.","reg_post_num","(","int",")",":","Number","of","post","convs",".","Defaults","to","1.","num_classes","(","int",")",":","Number","of","classes","in","dataset",".","Defaults","to","80.","cls_out_channels","(","int",")",":","Hidden","channels","in","cls","fcs",".","Defaults","to","1024.","reg_offset_out_channels","(","int",")",":","Hidden","and","output","channel","of","reg","offset","branch",".","Defaults","to","256.","reg_cls_out_channels","(","int",")",":","Hidden","and","output","channel","of","reg","cls","branch",".","Defaults","to","256.","num_cls_fcs","(","int",")",":","Number","of","fcs","for","cls","branch",".","Defaults","to","1.","num_reg_fcs","(","int",")",":","Number","of","fcs","for","reg","branch","..","Defaults","to","0.","reg_class_agnostic","(","bool",")",":","Class","agnostic","regression","or","not",".","Defaults","to","True",".","norm_cfg","(","dict",")",":","Config","of","norm","layers",".","Defaults","to","None",".","bbox_coder","(","dict",")",":","Config","of","bbox","coder",".","Defaults","'BucketingBBoxCoder","'",".","loss_cls","(","dict",")",":","Config","of","classification","loss",".","loss_bbox_cls","(","dict",")",":","Config","of","classification","loss","for","bbox","branch",".","loss_bbox_reg","(","dict",")",":","Config","of","regression","loss","for","bbox","branch",".","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None","."]
docstr: Refine and extract side-aware features without split them.
docstr_tok: ["Refine","and","extract","side-aware","features","without","split","them","."]
code: def side_aware_feature_extractor(self, reg_x: Tensor) -> tuple:
      """Refine and extract side-aware features without split them."""
      for reg_pre_conv in self.reg_pre_convs:
          reg_x = reg_pre_conv(reg_x)
      reg_fx, reg_fy = self.attention_pool(reg_x)
  
      if self.reg_post_num > 0:
          reg_fx = reg_fx.unsqueeze(2)
          reg_fy = reg_fy.unsqueeze(3)
          for i in range(self.reg_post_num):
              reg_fx = self.reg_post_conv_xs[i](reg_fx)
              reg_fy = self.reg_post_conv_ys[i](reg_fy)
          reg_fx = reg_fx.squeeze(2)
          reg_fy = reg_fy.squeeze(3)
      if self.reg_feat_up_ratio > 1:
          reg_fx = self.relu(self.upsample_x(reg_fx))
          reg_fy = self.relu(self.upsample_y(reg_fy))
      reg_fx = torch.transpose(reg_fx, 1, 2)
      reg_fy = torch.transpose(reg_fy, 1, 2)
      return reg_fx.contiguous(), reg_fy.contiguous()
  
imports: from typing import List, Optional, Sequence, Tuple
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmengine.config import ConfigDict
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models.layers import multiclass_nms
  from mmdet.models.losses import accuracy
  from mmdet.models.task_modules import SamplingResult
  from mmdet.models.utils import multi_apply
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, OptMultiConfig
  from .bbox_head import BBoxHead
label_desc: Use image node_id 5 for calling the SABLHead obj's underlying member method code with example usage: obj.side_aware_feature_extractor(reg_x) and returns: reg_fx,  reg_fy