def compute_statistics_jit(
    overlaps,
    gt_datas,
    dt_datas,
    ignored_gt,
    ignored_det,
    ignored_bboxes,
    min_overlap,
    thresh=0.0,
    compute_fp=False,
    compute_angular_metrics=False
):
    """Compute TP/FP statistics.
    Modified from https://github.com/sshaoehuai/PointRCNN/blob/master/tools/kitti_object_eval_python/eval.py
    """
    det_size = dt_datas.shape[0]
    gt_size = gt_datas.shape[0]
    dt_scores = dt_datas[:, -1]
    dt_yaws = dt_datas[:, 4]
    gt_yaws = gt_datas[:, 4]
    dt_alphas = dt_datas[:, 5]
    gt_alphas = gt_datas[:, 5]
    dt_bboxes = dt_datas[:, :4]
    gt_dimensions = gt_datas[:, 6:9]
    dt_dimensions = dt_datas[:, 6:9]

    assigned_detection = [False] * det_size
    ignored_threshold = [False] * det_size
    if compute_fp:
        for i in range(det_size):
            if (dt_scores[i] < thresh):
                ignored_threshold[i] = True

    NO_DETECTION = np.finfo(np.float32).min
    tp, fp, fn, error_yaw, similarity, match_degree, scale_error, confidence_error = 0, 0, 0, 0, 0, 0, 0, 0
    thresholds = np.zeros((gt_size, ))
    thresh_idx = 0
    delta_yaw = np.zeros((gt_size, ))
    delta_alpha = np.zeros((gt_size, ))
    delta_idx = 0
    for i in range(gt_size):
        if ignored_gt[i] == -1:
            continue
        det_idx = -1
        valid_detection = NO_DETECTION

        max_overlap = np.finfo(np.float32).min
        target_scale_iou = 0
        assigned_ignored_det = False

        for j in range(det_size):
            if (ignored_det[j] == -1):
                continue
            if (assigned_detection[j]):
                continue
            if (ignored_threshold[j]):
                continue
            overlap = overlaps[j, i]
            scale_iou = compute_scale_error(gt_dimensions[i, :], dt_dimensions[j, :])
            dt_score = dt_scores[j]

            # Not hit during TP/FP computation
            if (not compute_fp and (overlap > min_overlap) and dt_score > valid_detection):
                assert not compute_fp, "For sanity, compute_fp shoudl be False if we are here"
                det_idx = j
                valid_detection = dt_score
            elif (
                compute_fp and (overlap > min_overlap) and (overlap > max_overlap or assigned_ignored_det)
                and ignored_det[j] == 0
            ):
                max_overlap = overlap
                target_scale_iou = scale_iou
                det_idx = j
                valid_detection = 1
                assigned_ignored_det = False

            elif (compute_fp and (overlap > min_overlap) and (valid_detection == NO_DETECTION) and ignored_det[j] == 1):
                det_idx = j
                valid_detection = 1
                assigned_ignored_det = True

        # No matched prediction found, valid GT
        if (valid_detection == NO_DETECTION) and ignored_gt[i] == 0:
            fn += 1

        # Matched prediction, but NO valid GT or matched prediction is too small so we ignore it (NOT BECAUSE THE
        # CLASS IS WRONG)
        elif ((valid_detection != NO_DETECTION) and (ignored_gt[i] == 1 or ignored_det[det_idx] == 1)):
            assigned_detection[det_idx] = True

        # Matched prediction
        elif valid_detection != NO_DETECTION:
            tp += 1
            match_degree += abs(max_overlap)
            scale_error += 1.0 - abs(target_scale_iou)
            confidence_error += -math.log(dt_scores[det_idx])
            # Build a big list of all thresholds associated to true positives
            thresholds[thresh_idx] = dt_scores[det_idx]
            thresh_idx += 1

            if compute_angular_metrics:
                delta_yaw[delta_idx] = abs(angle_diff(float(gt_yaws[i]), float(dt_yaws[det_idx]), 2 * np.pi))
                delta_alpha[delta_idx] = gt_alphas[i] - dt_alphas[det_idx]
                delta_idx += 1

            assigned_detection[det_idx] = True

    if compute_fp:
        for i in range(det_size):
            if (not (assigned_detection[i] or ignored_det[i] == -1 or ignored_det[i] == 1 or ignored_threshold[i])):
                fp += 1
        nstuff = 0
        fp -= nstuff
        if compute_angular_metrics:
            tmp_yaw = np.zeros((fp + delta_idx, ))
            tmp_alpha = np.zeros((fp + delta_idx, ))
            for i in range(delta_idx):
                tmp_yaw[i + fp] = delta_yaw[i]
                tmp_alpha[i + fp] = (1.0 + np.cos(delta_alpha[i])) / 2.0

            if tp > 0 or fp > 0:
                error_yaw = np.sum(tmp_yaw)
                similarity = np.sum(tmp_alpha)
            else:
                error_yaw = -1
                similarity = -1

    return tp, fp, fn, error_yaw, similarity, thresholds[:thresh_idx], match_degree, confidence_error, scale_error
Compute TP/FP statistics.
    Modified from https://github.com/sshaoehuai/PointRCNN/blob/master/tools/kitti_object_eval_python/eval.py
    
tridet/evaluators/kitti_3d_evaluator.py