code: def _get_per_class_ap(
      labels: List[Dict[str, Any]], predictions: List[np.ndarray]
  ) -> Dict[int, float]:
      """Computes the Average Precision (AP) for each class in an object detection task.
      It takes a list of label dictionaries and a list of prediction arrays as inputs.
      It calculates AP values for different Intersection over Union (IoU) thresholds, averages them per class, and then scales the AP values.
      """
      iou_thrs = np.linspace(
          0.5,
          0.95,
          int(np.round((0.95 - 0.5) / 0.05)) + 1,
          endpoint=True,
      )
      class_num_to_iou_list = defaultdict(list)
      for threshold in iou_thrs:
          ap_per_class = _calculate_ap_per_class(
              labels, predictions, iou_threshold=threshold
          )
          for class_num in range(0, len(ap_per_class)):
              class_num_to_iou_list[class_num].append(
                  ap_per_class[class_num]
              )
      class_num_to_AP = {}
      for class_num in class_num_to_iou_list:
          class_num_to_AP[class_num] = (
              np.mean(class_num_to_iou_list[class_num])
              * AP_SCALE_FACTOR
          )
      return class_num_to_AP
  
file_path: cleanlab/cleanlab/object_detection/filter.py
imports: from collections import defaultdict
  from multiprocessing import Pool
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  from cleanlab.internal.constants import ALPHA, HIGH_PROBABILITY_THRESHOLD, LOW_PROBABILITY_THRESHOLD, OVERLOOKED_THRESHOLD_FACTOR, BADLOC_THRESHOLD_FACTOR, SWAP_THRESHOLD_FACTOR, AP_SCALE_FACTOR
  from cleanlab.internal.object_detection_utils import assert_valid_inputs
  from cleanlab.object_detection.rank import _get_valid_inputs_for_compute_scores, _separate_label, _separate_prediction, compute_badloc_box_scores, compute_overlooked_box_scores, compute_swap_box_scores, get_label_quality_scores, issues_from_scores, _get_overlap_matrix
label_desc: Use image node_id 10 for calling a global function with example usage: _get_per_class_ap(labels, predictions) and returns: class_num_to_AP