class_docstr: This class computes the loss for DETR.
  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","DETR",".","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
      idx = self._get_src_permutation_idx(indices)
      src_boxes = outputs["pred_boxes"][idx]
      target_boxes = torch.cat(
          [t["boxes"][i] for t, (_, i) in zip(targets, indices)], dim=0
      )
  
      loss_bbox = F.l1_loss(src_boxes, target_boxes, reduction="none")
  
      losses = {}
      losses["loss_bbox"] = loss_bbox.sum() / num_boxes
  
      loss_giou = 1 - torch.diag(
          box_ops.generalized_box_iou(
              box_ops.box_cxcywh_to_xyxy(src_boxes),
              box_ops.box_cxcywh_to_xyxy(target_boxes),
          )
      )
      losses["loss_giou"] = loss_giou.sum() / num_boxes
      return losses
  
imports: import torch
  import torch.nn.functional
  from torch import nn
  from util import box_ops
  from util.misc import NestedTensor, nested_tensor_from_tensor_list, accuracy, get_world_size, interpolate, is_dist_avail_and_initialized
  from .backbone import build_backbone
  from .matcher import build_matcher
  from .segmentation import DETRsegm, PostProcessPanoptic, PostProcessSegm, dice_loss, sigmoid_focal_loss
  from .transformer import build_transformer
label_desc: Use image node_id 4 for calling the SetCriterion obj's underlying member method code with example usage: obj.loss_boxes(outputs, targets, indices, num_boxes) and returns: losses