def METHOD_NAME(self, p_det, anchor, t_conf, t_box):
    pshape = paddle.shape(p_det)
    pshape.stop_gradient = True
    nB, nGh, nGw = pshape[0], pshape[-2], pshape[-1]
    nA = len(anchor)
    p_det = paddle.reshape(
        p_det, [nB, nA, self.num_classes + 5, nGh, nGw]).transpose(
            (0, 1, 3, 4, 2))
    # 1. loss_conf: cross_entropy
    p_conf = p_det[:, :, :, :, 4:6]
    p_conf_flatten = paddle.reshape(p_conf, [-1, 2])
    t_conf_flatten = t_conf.flatten()
    t_conf_flatten = paddle.cast(t_conf_flatten, dtype="int64")
    t_conf_flatten.stop_gradient = True
    loss_conf = F.cross_entropy(
        p_conf_flatten, t_conf_flatten, ignore_index=-1, reduction='mean')
    loss_conf.stop_gradient = False
    # 2. loss_box: smooth_l1_loss
    p_box = p_det[:, :, :, :, :4]
    p_box_flatten = paddle.reshape(p_box, [-1, 4])
    t_box_flatten = paddle.reshape(t_box, [-1, 4])
    fg_inds = paddle.nonzero(t_conf_flatten > 0).flatten()
    if fg_inds.numel() > 0:
        reg_delta = paddle.gather(p_box_flatten, fg_inds)
        reg_target = paddle.gather(t_box_flatten, fg_inds)
    else:
        reg_delta = paddle.to_tensor([0, 0, 0, 0], dtype='float32')
        reg_delta.stop_gradient = False
        reg_target = paddle.to_tensor([0, 0, 0, 0], dtype='float32')
    reg_target.stop_gradient = True
    loss_box = F.smooth_l1_loss(
        reg_delta, reg_target, reduction='mean', delta=1.0)
    loss_box.stop_gradient = False
    return loss_conf, loss_box