code: def get_class_ids_from_numpy_preds(
      predictions: t.Sequence[t.Union[np.ndarray]], task_type: TaskType
  ) -> t.Dict[int, int]:
      """Return the number of images containing each class_id.
  
      Returns
      -------
      Dict[int, int]
          A dictionary mapping each class_id to the number of images containing it.
      """
      if task_type == TaskType.CLASSIFICATION:
          return Counter([np.argmax(x) for x in predictions])
      elif task_type == TaskType.OBJECT_DETECTION:
          class_ids_per_image = [
              pred[:, 5]
              for pred in predictions
              if pred is not None and len(pred.shape) == 2
          ]
          return Counter(np.hstack(class_ids_per_image))
      elif task_type == TaskType.SEMANTIC_SEGMENTATION:
          classes_predicted_per_image = [
              np.unique(np.argmax(pred, axis=0))
              for pred in predictions
              if pred is not None
          ]
          return Counter(np.hstack(classes_predicted_per_image))
      else:
          raise ValueError(f"Unsupported task type: {task_type}")
  
imports: import random
  import sys
  import typing
  from collections import Counter
  from enum import Enum
  from numbers import Number
  import numpy
  from typing_extensions import NotRequired, TypedDict
  from deepchecks.core.errors import DatasetValidationError
  from deepchecks.utils.logger import get_logger
label_desc: Use image node_id 5 for calling a global function with example usage: get_class_ids_from_numpy_preds(predictions, task_type) and returns: Counter, Counter, Counter