def forward(self, head_out, anchors):
    "\n        Decode the bbox and do NMS for JDE model. \n\n        Args:\n            head_out (list): Bbox_pred and cls_prob of bbox_head output.\n            anchors (list): Anchors of JDE model.\n\n        Returns:\n            boxes_idx (Tensor): The index of kept bboxes after decode 'JDEBox'. \n            bbox_pred (Tensor): The output is the prediction with shape [N, 6]\n                including labels, scores and bboxes.\n            bbox_num (Tensor): The number of prediction of each batch with shape [N].\n            nms_keep_idx (Tensor): The index of kept bboxes after NMS. \n        "
    (boxes_idx, yolo_boxes_scores) = self.decode(head_out, anchors)
    if (len(boxes_idx) == 0):
        boxes_idx = self.fake_boxes_idx
        yolo_boxes_out = self.fake_yolo_boxes_out
        yolo_scores_out = self.fake_yolo_scores_out
    else:
        yolo_boxes = paddle.gather_nd(yolo_boxes_scores, boxes_idx)
        yolo_boxes_out = paddle.reshape(yolo_boxes[:, :4], shape=[1, len(boxes_idx), 4])
        yolo_scores_out = paddle.reshape(yolo_boxes[:, 4:5], shape=[1, 1, len(boxes_idx)])
        boxes_idx = boxes_idx[:, 1:]
    if self.return_idx:
        (bbox_pred, bbox_num, nms_keep_idx) = self.nms(yolo_boxes_out, yolo_scores_out, self.num_classes)
        if (bbox_pred.shape[0] == 0):
            bbox_pred = self.fake_bbox_pred
            bbox_num = self.fake_bbox_num
            nms_keep_idx = self.fake_nms_keep_idx
        return (boxes_idx, bbox_pred, bbox_num, nms_keep_idx)
    else:
        (bbox_pred, bbox_num, _) = self.nms(yolo_boxes_out, yolo_scores_out, self.num_classes)
        if (bbox_pred.shape[0] == 0):
            bbox_pred = self.fake_bbox_pred
            bbox_num = self.fake_bbox_num
        return (_, bbox_pred, bbox_num, _)
Decode the bbox and do NMS for JDE model. 

Args:
    head_out (list): Bbox_pred and cls_prob of bbox_head output.
    anchors (list): Anchors of JDE model.

Returns:
    boxes_idx (Tensor): The index of kept bboxes after decode 'JDEBox'. 
    bbox_pred (Tensor): The output is the prediction with shape [N, 6]
        including labels, scores and bboxes.
    bbox_num (Tensor): The number of prediction of each batch with shape [N].
    nms_keep_idx (Tensor): The index of kept bboxes after NMS.
def forward(self, head_out, anchors):
    "\n        Decode the bbox and do NMS for JDE model. \n\n        Args:\n            head_out (list): Bbox_pred and cls_prob of bbox_head output.\n            anchors (list): Anchors of JDE model.\n\n        Returns:\n            boxes_idx (Tensor): The index of kept bboxes after decode 'JDEBox'. \n            bbox_pred (Tensor): The output is the prediction with shape [N, 6]\n                including labels, scores and bboxes.\n            bbox_num (Tensor): The number of prediction of each batch with shape [N].\n            nms_keep_idx (Tensor): The index of kept bboxes after NMS. \n        "
    (boxes_idx, yolo_boxes_scores) = self.decode(head_out, anchors)
    if (len(boxes_idx) == 0):
        boxes_idx = self.fake_boxes_idx
        yolo_boxes_out = self.fake_yolo_boxes_out
        yolo_scores_out = self.fake_yolo_scores_out
    else:
        yolo_boxes = paddle.gather_nd(yolo_boxes_scores, boxes_idx)
        yolo_boxes_out = paddle.reshape(yolo_boxes[:, :4], shape=[1, len(boxes_idx), 4])
        yolo_scores_out = paddle.reshape(yolo_boxes[:, 4:5], shape=[1, 1, len(boxes_idx)])
        boxes_idx = boxes_idx[:, 1:]
    if self.return_idx:
        (bbox_pred, bbox_num, nms_keep_idx) = self.nms(yolo_boxes_out, yolo_scores_out, self.num_classes)
        if (bbox_pred.shape[0] == 0):
            bbox_pred = self.fake_bbox_pred
            bbox_num = self.fake_bbox_num
            nms_keep_idx = self.fake_nms_keep_idx
        return (boxes_idx, bbox_pred, bbox_num, nms_keep_idx)
    else:
        (bbox_pred, bbox_num, _) = self.nms(yolo_boxes_out, yolo_scores_out, self.num_classes)
        if (bbox_pred.shape[0] == 0):
            bbox_pred = self.fake_bbox_pred
            bbox_num = self.fake_bbox_num
        return (_, bbox_pred, bbox_num, _)