def METHOD_NAME(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}')