def clean_kitti_data(gt_anno, dt_anno, current_class, difficulty, id_to_name, difficulty_level_to_params=None):
    """Function for filtering KITTI data by difficulty and class.

    We filter with the following heuristics:
        If a ground truth matches the current class AND it falls below the difficulty
        threshold, we count it as a valid gt (append 0 in `ignored_gt` list).

        If a ground truth matches the current class but NOT the difficulty, OR it matches
        a class that is semantically too close to penalize (i.e. Van <-> Car),
        we ignore it (append 1 in `ignored_gt` list)

        If a ground truth doesn't belong to the current class, we ignore it (append -1 in `ignored_gt`)

        If a ground truth corresponds to a "DontCare" box, we append that box to the `ignored_bboxes` list.

        If a prediction matches the current class AND is above the minimum height threshold, we count it
        as a valid detection (append 0 in `ignored_dt`)

        If a prediction matches the current class AND it is too small, we ignore it (append 1 in `ignored_dt`)

        If a prediction doesn't belong to the class, we ignore it (append -1 in `ignored_dt`)

    Parameters
    ----------
    gt_anno: dict
        KITTI format ground truth. Please refer to note at the top for details on format.

    dt_anno: dict
        KITTI format prediction.  Please refer to note at the top for details on format.

    current_class: int
        Class ID, as int

    difficulty: int
        Difficulty: easy=0, moderate=1, difficult=2

    id_to_name: dict
        Mapping from class ID (int) to string name

    difficulty_level_to_params: dict default= None

    Returns
    -------
    num_valid_gt: int
        Number of valid ground truths

    ignored_gt: list[int]
        List of length num GTs. Populated as described above.

    ignored_dt: list[int]
        List of length num detections. Populated as described above.

    ignored_bboxes: list[np.ndarray]
        List of np.ndarray corresponding to boxes that are to be ignored
    """
    ignored_bboxes, ignored_gt, ignored_dt = [], [], []
    current_cls_name = id_to_name[current_class].lower()
    num_gt = len(gt_anno["name"])
    num_dt = len(dt_anno["name"])
    num_valid_gt = 0

    for i in range(num_gt):
        bbox = gt_anno["bbox"][i]
        gt_name = gt_anno["name"][i].lower()
        height = bbox[3] - bbox[1]
        valid_class = -1

        # For KITTI, Van does not penalize car detections and person sitting does not penalize pedestrian
        if gt_name == current_cls_name:
            valid_class = 1
        elif current_cls_name == "Pedestrian".lower() and "Person_sitting".lower() == gt_name:
            valid_class = 0
        elif current_cls_name == "Car".lower() and "Van".lower() == gt_name:
            valid_class = 0
        else:
            valid_class = -1

        # Filter by occlusion/truncation
        ignore_for_truncation_occlusion = False
        if ((gt_anno["occluded"][i] > difficulty_level_to_params["max_occlusion"][difficulty])
            or (gt_anno["truncated"][i] > difficulty_level_to_params["max_truncation"][difficulty])
            or (height <= difficulty_level_to_params["min_height"][difficulty])):
            ignore_for_truncation_occlusion = True

        if valid_class == 1 and not ignore_for_truncation_occlusion:
            ignored_gt.append(0)
            num_valid_gt += 1
        elif valid_class == 0 or (ignore_for_truncation_occlusion and (valid_class == 1)):
            ignored_gt.append(1)
        else:
            ignored_gt.append(-1)

        # Track boxes are in "dontcare" areas
        if gt_name == "dontcare":
            ignored_bboxes.append(bbox)

    for i in range(num_dt):
        if dt_anno["name"][i].lower() == current_cls_name:
            valid_class = 1
        else:
            valid_class = -1
        height = abs(dt_anno["bbox"][i, 3] - dt_anno["bbox"][i, 1])

        # If a box is too small, ignore it
        if height < difficulty_level_to_params["min_height"][difficulty]:
            ignored_dt.append(1)
        elif valid_class == 1:
            ignored_dt.append(0)
        else:
            ignored_dt.append(-1)

    return num_valid_gt, ignored_gt, ignored_dt, ignored_bboxes
Function for filtering KITTI data by difficulty and class.

    We filter with the following heuristics:
        If a ground truth matches the current class AND it falls below the difficulty
        threshold, we count it as a valid gt (append 0 in `ignored_gt` list).

        If a ground truth matches the current class but NOT the difficulty, OR it matches
        a class that is semantically too close to penalize (i.e. Van <-> Car),
        we ignore it (append 1 in `ignored_gt` list)

        If a ground truth doesn't belong to the current class, we ignore it (append -1 in `ignored_gt`)

        If a ground truth corresponds to a "DontCare" box, we append that box to the `ignored_bboxes` list.

        If a prediction matches the current class AND is above the minimum height threshold, we count it
        as a valid detection (append 0 in `ignored_dt`)

        If a prediction matches the current class AND it is too small, we ignore it (append 1 in `ignored_dt`)

        If a prediction doesn't belong to the class, we ignore it (append -1 in `ignored_dt`)

    Parameters
    ----------
    gt_anno: dict
        KITTI format ground truth. Please refer to note at the top for details on format.

    dt_anno: dict
        KITTI format prediction.  Please refer to note at the top for details on format.

    current_class: int
        Class ID, as int

    difficulty: int
        Difficulty: easy=0, moderate=1, difficult=2

    id_to_name: dict
        Mapping from class ID (int) to string name

    difficulty_level_to_params: dict default= None

    Returns
    -------
    num_valid_gt: int
        Number of valid ground truths

    ignored_gt: list[int]
        List of length num GTs. Populated as described above.

    ignored_dt: list[int]
        List of length num detections. Populated as described above.

    ignored_bboxes: list[np.ndarray]
        List of np.ndarray corresponding to boxes that are to be ignored
    
tridet/evaluators/kitti_3d_evaluator.py