class_docstr: This class computes the loss for SparseRCNN.
  The process happens in two steps:
      1) we compute hungarian assignment between ground truth boxes and the outputs of the model
      2) we supervise each pair of matched ground-truth / prediction (supervise class and box)
class_docstr_tok: ["This","class","computes","the","loss","for","SparseRCNN",".","The","process","happens","in","two","steps",":","1",")","we","compute","hungarian","assignment","between","ground","truth","boxes","and","the","outputs","of","the","model","2",")","we","supervise","each","pair","of","matched","ground-truth","\/","prediction","(","supervise","class","and","box",")"]
docstr: Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss
  targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4]
  The target boxes are expected in format (center_x, center_y, w, h), normalized by the image size.
docstr_tok: ["Compute","the","losses","related","to","the","bounding","boxes",",","the","L1","regression","loss","and","the","GIoU","loss","targets","dicts","must","contain","the","key","``","boxes","''","containing","a","tensor","of","dim","[","nb_target_boxes",",","4","]","The","target","boxes","are","expected","in","format","(","center_x",",","center_y",",","w",",","h",")",",","normalized","by","the","image","size","."]
code: def loss_boxes(self, outputs, targets, indices, num_boxes):
      """Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss
      targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4]
      The target boxes are expected in format (center_x, center_y, w, h), normalized by the image size.
      """
      assert "pred_boxes" in outputs  # [batch_size, num_proposals, 4]
      src_idx = [src for (src, _) in indices]
      src_boxes_list = []
  
      for i in range(outputs["pred_boxes"].shape[0]):
          src_boxes_list.append(
              paddle.gather(
                  outputs["pred_boxes"][i], src_idx[i], axis=0
              )
          )
  
      src_boxes = paddle.concat(src_boxes_list, axis=0)
  
      target_boxes = paddle.concat(
          [
              paddle.gather(t["boxes"], I, axis=0)
              for t, (_, I) in zip(targets, indices)
          ],
          axis=0,
      )
      target_boxes.stop_gradient = True
      losses = {}
  
      losses["loss_giou"] = (
          self.giou_loss(src_boxes, target_boxes) / num_boxes
      )
  
      image_size = paddle.concat([v["img_whwh_tgt"] for v in targets])
      src_boxes_ = src_boxes / image_size
      target_boxes_ = target_boxes / image_size
  
      loss_bbox = F.l1_loss(src_boxes_, target_boxes_, reduction="sum")
      losses["loss_bbox"] = loss_bbox / num_boxes
  
      return losses
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from scipy.optimize import linear_sum_assignment
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.metric import accuracy
  from ppdet.core.workspace import register
  from ppdet.modeling.losses.iou_loss import GIoULoss
label_desc: Use image node_id 3 for calling the SparseRCNNLoss obj's underlying member method code with example usage: obj.loss_boxes(outputs, targets, indices, num_boxes) and returns: losses