code: def _get_class_instances(
      labels, class_instances_dict, class_names=None
  ) -> None:
      """Helper function to count the number of class instances in each image."""
      for cl in labels:
          if class_names is not None:
              cl = class_names[str(cl)]
          class_instances_dict[cl] += 1
  
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 14 for calling a global function with example usage: _get_class_instances(labels, class_instances_dict, class_names) without return types