def METHOD_NAME(self, bbox_pred, targets, indices, avg_factor):
    bboxes = paddle.concat([
        paddle.gather(
            src, src_idx, axis=0)
        for src, (src_idx, _) in zip(bbox_pred, indices)
    ])
    tgt_bboxes = paddle.concat([
        paddle.gather(
            tgt['boxes'], tgt_idx, axis=0)
        for tgt, (_, tgt_idx) in zip(targets, indices)
    ])
    tgt_bboxes.stop_gradient = True
    im_shapes = paddle.concat([tgt['img_whwh_tgt'] for tgt in targets])
    bboxes_norm = bboxes / im_shapes
    tgt_bboxes_norm = tgt_bboxes / im_shapes
    loss_giou = self.giou_loss(bboxes, tgt_bboxes) / avg_factor
    loss_bbox = F.l1_loss(
        bboxes_norm, tgt_bboxes_norm, reduction='sum') / avg_factor
    losses = {
        'loss_bbox': loss_bbox * self.loss_weights['loss_bbox'],
        'loss_giou': loss_giou * self.loss_weights['loss_giou']
    }
    return losses