class_docstr: The box-to-box transform defined in Rotated R-CNN. The transformation is parameterized
  by 5 deltas: (dx, dy, dw, dh, da). The transformation scales the box's width and height
  by exp(dw), exp(dh), shifts a box's center by the offset (dx * width, dy * height),
  and rotate a box's angle by da (radians).
  Note: angles of deltas are in radians while angles of boxes are in degrees.
class_docstr_tok: ["The","box-to-box","transform","defined","in","Rotated","R-CNN",".","The","transformation","is","parameterized","by","5","deltas",":","(","dx",",","dy",",","dw",",","dh",",","da",")",".","The","transformation","scales","the","box","'s","width","and","height","by","exp","(","dw",")",",","exp","(","dh",")",",","shifts","a","box","'s","center","by","the","offset","(","dx","*","width",",","dy","*","height",")",",","and","rotate","a","box","'s","angle","by","da","(","radians",")",".","Note",":","angles","of","deltas","are","in","radians","while","angles","of","boxes","are","in","degrees","."]
docstr: Get box regression transformation deltas (dx, dy, dw, dh, da) that can be used
  to transform the `src_boxes` into the `target_boxes`. That is, the relation
  ``target_boxes == self.apply_deltas(deltas, src_boxes)`` is true (unless
  any delta is too large and is clamped).
  
  Args:
      src_boxes (Tensor): Nx5 source boxes, e.g., object proposals
      target_boxes (Tensor): Nx5 target of the transformation, e.g., ground-truth
          boxes.
docstr_tok: ["Get","box","regression","transformation","deltas","(","dx",",","dy",",","dw",",","dh",",","da",")","that","can","be","used","to","transform","the","`","src_boxes","`","into","the","`","target_boxes","`",".","That","is",",","the","relation","``","target_boxes","==","self.apply_deltas","(","deltas",",","src_boxes",")","``","is","true","(","unless","any","delta","is","too","large","and","is","clamped",")",".","Args",":","src_boxes","(","Tensor",")",":","Nx5","source","boxes",",","e.g.",",","object","proposals","target_boxes","(","Tensor",")",":","Nx5","target","of","the","transformation",",","e.g.",",","ground-truth","boxes","."]
code: def get_deltas(self, src_boxes, target_boxes):
      """
      Get box regression transformation deltas (dx, dy, dw, dh, da) that can be used
      to transform the `src_boxes` into the `target_boxes`. That is, the relation
      ``target_boxes == self.apply_deltas(deltas, src_boxes)`` is true (unless
      any delta is too large and is clamped).
  
      Args:
          src_boxes (Tensor): Nx5 source boxes, e.g., object proposals
          target_boxes (Tensor): Nx5 target of the transformation, e.g., ground-truth
              boxes.
      """
      assert isinstance(src_boxes, torch.Tensor), type(src_boxes)
      assert isinstance(target_boxes, torch.Tensor), type(target_boxes)
  
      (
          src_ctr_x,
          src_ctr_y,
          src_widths,
          src_heights,
          src_angles,
      ) = torch.unbind(src_boxes, dim=1)
  
      (
          target_ctr_x,
          target_ctr_y,
          target_widths,
          target_heights,
          target_angles,
      ) = torch.unbind(target_boxes, dim=1)
  
      wx, wy, ww, wh, wa = self.weights
      dx = wx * (target_ctr_x - src_ctr_x) / src_widths
      dy = wy * (target_ctr_y - src_ctr_y) / src_heights
      dw = ww * torch.log(target_widths / src_widths)
      dh = wh * torch.log(target_heights / src_heights)
      # Angles of deltas are in radians while angles of boxes are in degrees.
      # the conversion to radians serve as a way to normalize the values
      da = target_angles - src_angles
      da = (da + 180.0) % 360.0 - 180.0  # make it in [-180, 180)
      da *= wa * math.pi / 180.0
  
      deltas = torch.stack((dx, dy, dw, dh, da), dim=1)
      assert (
          (src_widths > 0).all().item()
      ), "Input boxes to Box2BoxTransformRotated are not valid!"
      return deltas
  
file_path: detectron2/detectron2/modeling/box_regression.py
imports: import math
  from typing import List, Tuple, Union
  import torch
  from fvcore.nn import giou_loss, smooth_l1_loss
  from torch.nn import functional
  from detectron2.layers import cat, ciou_loss, diou_loss
  from detectron2.structures import Boxes
label_desc: Use image node_id 2 for calling the Box2BoxTransformRotated obj's underlying member method code with example usage: obj.get_deltas(src_boxes, target_boxes) and returns: deltas