class_docstr: YOLO BBox coder.
  
  Following `YOLO <https://arxiv.org/abs/1506.02640>`_, this coder divide
  image into grids, and encode bbox (x1, y1, x2, y2) into (cx, cy, dw, dh).
  cx, cy in [0., 1.], denotes relative center position w.r.t the center of
  bboxes. dw, dh are the same as :obj:`DeltaXYWHBBoxCoder`.
  
  Args:
      eps (float): Min value of cx, cy when encoding.
docstr: Get box regression transformation deltas that can be used to
  transform the ``bboxes`` into the ``gt_bboxes``.
  
  Args:
      bboxes (torch.Tensor): Source boxes, e.g., anchors.
      gt_bboxes (torch.Tensor): Target of the transformation, e.g.,
          ground-truth boxes.
      stride (torch.Tensor | int): Stride of bboxes.
  
  Returns:
      torch.Tensor: Box transformation deltas
docstr_tok: ["Get","box","regression","transformation","deltas","that","can","be","used","to","transform","the","``","bboxes","``","into","the","``","gt_bboxes","``",".","Args",":","bboxes","(","torch.Tensor",")",":","Source","boxes",",","e.g.",",","anchors",".","gt_bboxes","(","torch.Tensor",")",":","Target","of","the","transformation",",","e.g.",",","ground-truth","boxes",".","stride","(","torch.Tensor","|","int",")",":","Stride","of","bboxes",".","Returns",":","torch.Tensor",":","Box","transformation","deltas"]
code: def encode(self, bboxes, gt_bboxes, stride):
      """Get box regression transformation deltas that can be used to
      transform the ``bboxes`` into the ``gt_bboxes``.
  
      Args:
          bboxes (torch.Tensor): Source boxes, e.g., anchors.
          gt_bboxes (torch.Tensor): Target of the transformation, e.g.,
              ground-truth boxes.
          stride (torch.Tensor | int): Stride of bboxes.
  
      Returns:
          torch.Tensor: Box transformation deltas
      """
  
      assert bboxes.size(0) == gt_bboxes.size(0)
      assert bboxes.size(-1) == gt_bboxes.size(-1) == 4
      x_center_gt = (gt_bboxes[..., 0] + gt_bboxes[..., 2]) * 0.5
      y_center_gt = (gt_bboxes[..., 1] + gt_bboxes[..., 3]) * 0.5
      w_gt = gt_bboxes[..., 2] - gt_bboxes[..., 0]
      h_gt = gt_bboxes[..., 3] - gt_bboxes[..., 1]
      x_center = (bboxes[..., 0] + bboxes[..., 2]) * 0.5
      y_center = (bboxes[..., 1] + bboxes[..., 3]) * 0.5
      w = bboxes[..., 2] - bboxes[..., 0]
      h = bboxes[..., 3] - bboxes[..., 1]
      w_target = torch.log((w_gt / w).clamp(min=self.eps))
      h_target = torch.log((h_gt / h).clamp(min=self.eps))
      x_center_target = ((x_center_gt - x_center) / stride + 0.5).clamp(
          self.eps, 1 - self.eps
      )
      y_center_target = ((y_center_gt - y_center) / stride + 0.5).clamp(
          self.eps, 1 - self.eps
      )
      encoded_bboxes = torch.stack(
          [x_center_target, y_center_target, w_target, h_target], dim=-1
      )
      return encoded_bboxes
  
file_path: insightface/detection/scrfd/mmdet/core/bbox/coder/yolo_bbox_coder.py
imports: import torch
  from ..builder import BBOX_CODERS
  from .base_bbox_coder import BaseBBoxCoder
label_desc: Use image node_id 2 for calling the YOLOBBoxCoder obj's underlying member method code with example usage: obj.encode(bboxes, gt_bboxes, stride) and returns: encoded_bboxes