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
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.
        
ppdet/modeling/losses/sparsercnn_loss.py