class_docstr: This class encodes and decodes a set of bounding boxes into
  the representation used for training the regressors.
class_docstr_tok: ["This","class","encodes","and","decodes","a","set","of","bounding","boxes","into","the","representation","used","for","training","the","regressors","."]
docstr: From a set of original boxes and encoded relative box offsets,
  get the decoded boxes.
  
  Arguments:
      rel_codes (Tensor): encoded boxes (bbox regression parameters)
      boxes (Tensor): reference boxes (anchors/proposals)
docstr_tok: ["From","a","set","of","original","boxes","and","encoded","relative","box","offsets",",","get","the","decoded","boxes",".","Arguments",":","rel_codes","(","Tensor",")",":","encoded","boxes","(","bbox","regression","parameters",")","boxes","(","Tensor",")",":","reference","boxes","(","anchors\/proposals",")"]
code: def decode_single(self, rel_codes, boxes):
      """
      From a set of original boxes and encoded relative box offsets,
      get the decoded boxes.
  
      Arguments:
          rel_codes (Tensor): encoded boxes (bbox regression parameters)
          boxes (Tensor): reference boxes (anchors/proposals)
      """
      boxes = boxes.to(rel_codes.dtype)
  
      # xmin, ymin, xmax, ymax
      widths = boxes[:, 2] - boxes[:, 0]  # anchor/proposal宽度
      heights = boxes[:, 3] - boxes[:, 1]  # anchor/proposal高度
      ctr_x = boxes[:, 0] + 0.5 * widths  # anchor/proposal中心x坐标
      ctr_y = boxes[:, 1] + 0.5 * heights  # anchor/proposal中心y坐标
  
      (
          wx,
          wy,
          ww,
          wh,
      ) = self.weights  # RPN中为[1,1,1,1], fastrcnn中为[10,10,5,5]
      dx = rel_codes[:, 0::4] / wx  # 预测anchors/proposals的中心坐标x回归参数
      dy = rel_codes[:, 1::4] / wy  # 预测anchors/proposals的中心坐标y回归参数
      dw = rel_codes[:, 2::4] / ww  # 预测anchors/proposals的宽度回归参数
      dh = rel_codes[:, 3::4] / wh  # 预测anchors/proposals的高度回归参数
  
      # limit max value, prevent sending too large values into torch.exp()
      # self.bbox_xform_clip=math.log(1000. / 16)   4.135
      dw = torch.clamp(dw, max=self.bbox_xform_clip)
      dh = torch.clamp(dh, max=self.bbox_xform_clip)
  
      pred_ctr_x = dx * widths[:, None] + ctr_x[:, None]
      pred_ctr_y = dy * heights[:, None] + ctr_y[:, None]
      pred_w = torch.exp(dw) * widths[:, None]
      pred_h = torch.exp(dh) * heights[:, None]
  
      # xmin
      pred_boxes1 = (
          pred_ctr_x
          - torch.tensor(
              0.5, dtype=pred_ctr_x.dtype, device=pred_w.device
          )
          * pred_w
      )
      # ymin
      pred_boxes2 = (
          pred_ctr_y
          - torch.tensor(
              0.5, dtype=pred_ctr_y.dtype, device=pred_h.device
          )
          * pred_h
      )
      # xmax
      pred_boxes3 = (
          pred_ctr_x
          + torch.tensor(
              0.5, dtype=pred_ctr_x.dtype, device=pred_w.device
          )
          * pred_w
      )
      # ymax
      pred_boxes4 = (
          pred_ctr_y
          + torch.tensor(
              0.5, dtype=pred_ctr_y.dtype, device=pred_h.device
          )
          * pred_h
      )
  
      pred_boxes = torch.stack(
          (pred_boxes1, pred_boxes2, pred_boxes3, pred_boxes4), dim=2
      ).flatten(1)
      return pred_boxes
  
imports: import torch
  import math
  from typing import List, Tuple
  from torch import Tensor
label_desc: Use image node_id 5 for calling the BoxCoder obj's underlying member method code with example usage: obj.decode_single(rel_codes, boxes) and returns: pred_boxes