code: def object_counts_per_image(
      labels=None,
      predictions=None,
      *,
      auxiliary_inputs=None,
  ) -> Tuple[List, List]:
      """Return the number of annotated and predicted objects for each image in the dataset.
  
      This method can help you discover images with abnormally many/few object annotations.
  
      Parameters
      ----------
      labels :
          Annotated boxes and class labels in the original dataset, which may contain some errors.
          This is a list of ``N`` dictionaries such that ``labels[i]`` contains the given labels for the `i`-th image in the following format:
          ``{'bboxes': np.ndarray((L,4)), 'labels': np.ndarray((L,)), 'image_name': str}`` where ``L`` is the number of annotated bounding boxes
          for the `i`-th image and ``bboxes[l]`` is a bounding box of coordinates in ``[x1,y1,x2,y2]`` format with given class label ``labels[j]``.
          ``image_name`` is an optional part of the labels that can be used to later refer to specific images.
  
         For more information on proper labels formatting, check out the `MMDetection library <https://mmdetection.readthedocs.io/en/dev-3.x/advanced_guides/customize_dataset.html>`_.
  
      predictions :
          Predictions output by a trained object detection model.
          For the most accurate results, predictions should be out-of-sample to avoid overfitting, eg. obtained via :ref:`cross-validation <pred_probs_cross_val>`.
          This is a list of ``N`` ``np.ndarray`` such that ``predictions[i]`` corresponds to the model prediction for the `i`-th image.
          For each possible class ``k`` in 0, 1, ..., K-1: ``predictions[i][k]`` is a ``np.ndarray`` of shape ``(M,5)``,
          where ``M`` is the number of predicted bounding boxes for class ``k``. Here the five columns correspond to ``[x1,y1,x2,y2,pred_prob]``,
          where ``[x1,y1,x2,y2]`` are coordinates of the bounding box predicted by the model
          and ``pred_prob`` is the model's confidence in the predicted class label for this bounding box.
  
          Note: Here, ``[x1,y1]`` corresponds to the coordinates of the bottom-left corner of the bounding box, while ``[x2,y2]`` corresponds to the coordinates of the top-right corner of the bounding box. The last column, pred_prob, represents the predicted probability that the bounding box contains an object of the class k.
  
          For more information see the `MMDetection package <https://github.com/open-mmlab/mmdetection>`_ for an example object detection library that outputs predictions in the correct format.
  
      auxiliary_inputs: optional
          Auxiliary inputs to be used in the computation of counts.
          The `auxiliary_inputs` can be computed using :py:func:`rank._get_valid_inputs_for_compute_scores <cleanlab.object_detection.rank._get_valid_inputs_for_compute_scores>`.
          It is internally computed from the given `labels` and `predictions`.
  
      Returns
      -------
      object_counts: Tuple[List, List]
          A tuple containing two lists. The first is an array of shape ``(N,)`` containing the number of annotated objects for each image in the dataset.
          The second is an array of shape ``(N,)`` containing the number of predicted objects for each image in the dataset.
      """
      if auxiliary_inputs is None:
          auxiliary_inputs = _get_valid_inputs_for_compute_scores(
              ALPHA, labels, predictions
          )
      return (
          [len(sample["lab_bboxes"]) for sample in auxiliary_inputs],
          [len(sample["pred_bboxes"]) for sample in auxiliary_inputs],
      )
  
imports: from multiprocessing import Pool
  from typing import Optional, Any, Dict, Tuple, Union, List, TYPE_CHECKING, TypeVar, DefaultDict
  import numpy
  import collections
  from cleanlab.internal.constants import MAX_CLASS_TO_SHOW, ALPHA, EPSILON, TINY_VALUE
  from cleanlab.object_detection.filter import _filter_by_class, _calculate_true_positives_false_positives
  from cleanlab.object_detection.rank import _get_valid_inputs_for_compute_scores, _separate_prediction, _separate_label, _get_prediction_type
  from cleanlab.internal.object_detection_utils import bbox_xyxy_to_xywh
label_desc: Use image node_id 1 for calling a global function with example usage: object_counts_per_image(labels, predictions) and returns: unknown,  unknown