class_docstr: AnchorGenerator by paddle
class_docstr_tok: ["AnchorGenerator","by","paddle"]
docstr: :param bboxes: shape (L, 4) (xmin, ymin, xmax, ymax)
  :return: dbboxes: shape (L, 5) (x_ctr, y_ctr, w, h, angle)
docstr_tok: [":","param","bboxes",":","shape","(","L",",","4",")","(","xmin",",","ymin",",","xmax",",","ymax",")",":","return",":","dbboxes",":","shape","(","L",",","5",")","(","x_ctr",",","y_ctr",",","w",",","h",",","angle",")"]
code: def rect2rbox(self, bboxes):
      """
      :param bboxes: shape (L, 4) (xmin, ymin, xmax, ymax)
      :return: dbboxes: shape (L, 5) (x_ctr, y_ctr, w, h, angle)
      """
      x1, y1, x2, y2 = paddle.split(bboxes, 4, axis=-1)
  
      x_ctr = (x1 + x2) / 2.0
      y_ctr = (y1 + y2) / 2.0
      edges1 = paddle.abs(x2 - x1)
      edges2 = paddle.abs(y2 - y1)
  
      rbox_w = paddle.maximum(edges1, edges2)
      rbox_h = paddle.minimum(edges1, edges2)
  
      # set angle
      inds = edges1 < edges2
      inds = paddle.cast(inds, paddle.float32)
      rboxes_angle = inds * np.pi / 2.0
  
      rboxes = paddle.concat(
          (x_ctr, y_ctr, rbox_w, rbox_h, rboxes_angle), axis=-1
      )
      return rboxes
  
imports: import math
  import paddle
  import paddle.nn
  import numpy
  from ppdet.core.workspace import register
label_desc: Use image node_id 7 for calling the S2ANetAnchorGenerator obj's underlying member method code with example usage: obj.rect2rbox(bboxes) and returns: rboxes