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 regresion 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.
code: def loss(
      self,
      cls_score,
      bbox_pred,
      rois,
      labels,
      label_weights,
      bbox_targets,
      bbox_weights,
      reduction_override=None,
  ):
      losses = dict()
      if cls_score is not None:
          avg_factor = max(
              torch.sum(label_weights > 0).float().item(), 1.0
          )
          losses["loss_cls"] = self.loss_cls(
              cls_score,
              labels,
              label_weights,
              avg_factor=avg_factor,
              reduction_override=reduction_override,
          )
          losses["acc"] = accuracy(cls_score, labels)
  
      if bbox_pred is not None:
          bucket_cls_preds, bucket_offset_preds = bbox_pred
          bucket_cls_targets, bucket_offset_targets = bbox_targets
          bucket_cls_weights, bucket_offset_weights = bbox_weights
          # edge cls
          bucket_cls_preds = bucket_cls_preds.view(-1, self.side_num)
          bucket_cls_targets = bucket_cls_targets.view(
              -1, self.side_num
          )
          bucket_cls_weights = bucket_cls_weights.view(
              -1, self.side_num
          )
          losses["loss_bbox_cls"] = self.loss_bbox_cls(
              bucket_cls_preds,
              bucket_cls_targets,
              bucket_cls_weights,
              avg_factor=bucket_cls_targets.size(0),
              reduction_override=reduction_override,
          )
  
          losses["loss_bbox_reg"] = self.loss_bbox_reg(
              bucket_offset_preds,
              bucket_offset_targets,
              bucket_offset_weights,
              avg_factor=bucket_offset_targets.size(0),
              reduction_override=reduction_override,
          )
  
      return losses
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, kaiming_init, normal_init, xavier_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
  from mmdet.models.builder import HEADS, build_loss
  from mmdet.models.losses import accuracy
label_desc: Use image node_id 15 for calling the SABLHead obj's underlying member method code with example usage: obj.loss(cls_score, bbox_pred, rois, labels, label_weights, bbox_targets, bbox_weights, reduction_override) and returns: losses