docstr: Args:
      img (Tensor): Input images of shape (N, C, H, W).
          Typically these should be mean centered and std scaled.
      img_metas (list[dict]): A List of image info dict where each dict
          has: 'img_shape', 'scale_factor', 'flip', and may also contain
          'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
          For details on the values of these keys see
          :class:`mmdet.datasets.pipelines.Collect`.
      gt_bboxes (list[Tensor]): Each item are the truth boxes for each
          image in [tl_x, tl_y, br_x, br_y] format.
      gt_labels (list[Tensor]): Class indices corresponding to each box.
      gt_keypoints (list[Tensor]): Each item are the truth keypoints for
          each image in [p^{1}_x, p^{1}_y, p^{1}_v, ..., p^{K}_x,
          p^{K}_y, p^{K}_v] format.
      gt_areas (list[Tensor]): mask areas corresponding to each box.
      gt_bboxes_ignore (None | list[Tensor]): Specify which bounding
          boxes can be ignored when computing the loss.
  
  Returns:
      dict[str, Tensor]: A dictionary of loss components.
docstr_tok: ["Args",":","img","(","Tensor",")",":","Input","images","of","shape","(","N",",","C",",","H",",","W",")",".","Typically","these","should","be","mean","centered","and","std","scaled",".","img_metas","(","list","[","dict","]",")",":","A","List","of","image","info","dict","where","each","dict","has",":","'img_shape","'",",","'scale_factor","'",",","'flip","'",",","and","may","also","contain","'filename","'",",","'ori_shape","'",",","'pad_shape","'",",","and","'img_norm_cfg","'",".","For","details","on","the","values","of","these","keys","see",":","class",":","`","mmdet.datasets.pipelines.Collect","`",".","gt_bboxes","(","list","[","Tensor","]",")",":","Each","item","are","the","truth","boxes","for","each","image","in","[","tl_x",",","tl_y",",","br_x",",","br_y","]","format",".","gt_labels","(","list","[","Tensor","]",")",":","Class","indices","corresponding","to","each","box",".","gt_keypoints","(","list","[","Tensor","]",")",":","Each","item","are","the","truth","keypoints","for","each","image","in","[","p^","{","1","}","_x",",","p^","{","1","}","_y",",","p^","{","1","}","_v",",","...",",","p^","{","K","}","_x",",","p^","{","K","}","_y",",","p^","{","K","}","_v","]","format",".","gt_areas","(","list","[","Tensor","]",")",":","mask","areas","corresponding","to","each","box",".","gt_bboxes_ignore","(","None","|","list","[","Tensor","]",")",":","Specify","which","bounding","boxes","can","be","ignored","when","computing","the","loss",".","Returns",":","dict","[","str",",","Tensor","]",":","A","dictionary","of","loss","components","."]
code: def get_loss(self):
      """
      Args:
          img (Tensor): Input images of shape (N, C, H, W).
              Typically these should be mean centered and std scaled.
          img_metas (list[dict]): A List of image info dict where each dict
              has: 'img_shape', 'scale_factor', 'flip', and may also contain
              'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
              For details on the values of these keys see
              :class:`mmdet.datasets.pipelines.Collect`.
          gt_bboxes (list[Tensor]): Each item are the truth boxes for each
              image in [tl_x, tl_y, br_x, br_y] format.
          gt_labels (list[Tensor]): Class indices corresponding to each box.
          gt_keypoints (list[Tensor]): Each item are the truth keypoints for
              each image in [p^{1}_x, p^{1}_y, p^{1}_v, ..., p^{K}_x,
              p^{K}_y, p^{K}_v] format.
          gt_areas (list[Tensor]): mask areas corresponding to each box.
          gt_bboxes_ignore (None | list[Tensor]): Specify which bounding
              boxes can be ignored when computing the loss.
  
      Returns:
          dict[str, Tensor]: A dictionary of loss components.
      """
  
      (
          img_metas,
          gt_bboxes,
          gt_labels,
          gt_keypoints,
          gt_areas,
      ) = self.get_inputs()
      gt_bboxes_ignore = getattr(self.inputs, "gt_bboxes_ignore", None)
  
      x = self.extract_feat(self.inputs)
      losses = self.bbox_head.forward_train(
          x,
          img_metas,
          gt_bboxes,
          gt_labels,
          gt_keypoints,
          gt_areas,
          gt_bboxes_ignore,
      )
      loss = 0
      for k, v in losses.items():
          loss += v
      losses["loss"] = loss
  
      return losses
  
file_path: PaddleDetection/ppdet/modeling/architectures/keypoint_petr.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  from ppdet.core.workspace import register
  from .meta_arch import BaseArch
  from ..None import layers
label_desc: Use image node_id 4 for calling the PETR obj's underlying member method code with example usage: obj.get_loss() and returns: losses