class_docstr: Bucketing BBox Coder for Side-Aware Boundary Localization (SABL).
  
  Boundary Localization with Bucketing and Bucketing Guided Rescoring
  are implemented here.
  
  Please refer to https://arxiv.org/abs/1912.04260 for more details.
  
  Args:
      num_buckets (int): Number of buckets.
      scale_factor (int): Scale factor of proposals to generate buckets.
      offset_topk (int): Topk buckets are used to generate
           bucket fine regression targets. Defaults to 2.
      offset_upperbound (float): Offset upperbound to generate
           bucket fine regression targets.
           To avoid too large offset displacements. Defaults to 1.0.
      cls_ignore_neighbor (bool): Ignore second nearest bucket or Not.
           Defaults to True.
      clip_border (bool, optional): Whether clip the objects outside the
          border of the image. Defaults to True.
docstr: Get bucketing estimation and fine regression targets during
  training.
  
  Args:
      bboxes (torch.Tensor or :obj:`BaseBoxes`): source boxes,
          e.g., object proposals.
      gt_bboxes (torch.Tensor or :obj:`BaseBoxes`): target of the
          transformation, e.g., ground truth boxes.
  
  Returns:
     encoded_bboxes(tuple[Tensor]): bucketing estimation
      and fine regression targets and weights
docstr_tok: ["Get","bucketing","estimation","and","fine","regression","targets","during","training",".","Args",":","bboxes","(","torch.Tensor","or",":","obj",":","`","BaseBoxes","`",")",":","source","boxes",",","e.g.",",","object","proposals",".","gt_bboxes","(","torch.Tensor","or",":","obj",":","`","BaseBoxes","`",")",":","target","of","the","transformation",",","e.g.",",","ground","truth","boxes",".","Returns",":","encoded_bboxes","(","tuple","[","Tensor","]",")",":","bucketing","estimation","and","fine","regression","targets","and","weights"]
code: def encode(
      self,
      bboxes: Union[Tensor, BaseBoxes],
      gt_bboxes: Union[Tensor, BaseBoxes],
  ) -> Tuple[Tensor]:
      """Get bucketing estimation and fine regression targets during
      training.
  
      Args:
          bboxes (torch.Tensor or :obj:`BaseBoxes`): source boxes,
              e.g., object proposals.
          gt_bboxes (torch.Tensor or :obj:`BaseBoxes`): target of the
              transformation, e.g., ground truth boxes.
  
      Returns:
         encoded_bboxes(tuple[Tensor]): bucketing estimation
          and fine regression targets and weights
      """
      bboxes = get_box_tensor(bboxes)
      gt_bboxes = get_box_tensor(gt_bboxes)
      assert bboxes.size(0) == gt_bboxes.size(0)
      assert bboxes.size(-1) == gt_bboxes.size(-1) == 4
      encoded_bboxes = bbox2bucket(
          bboxes,
          gt_bboxes,
          self.num_buckets,
          self.scale_factor,
          self.offset_topk,
          self.offset_upperbound,
          self.cls_ignore_neighbor,
      )
      return encoded_bboxes
  
file_path: mmdetection/mmdet/models/task_modules/coders/bucketing_bbox_coder.py
imports: from typing import Optional, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import BaseBoxes, HorizontalBoxes, bbox_rescale, get_box_tensor
  from .base_bbox_coder import BaseBBoxCoder
label_desc: Use image node_id 2 for calling the BucketingBBoxCoder obj's underlying member method code with example usage: obj.encode(bboxes, gt_bboxes) and returns: encoded_bboxes