code: def validate_predictions_format(predictions, task_type: TaskType):
      """Validate that the predictions are in the required format based on task_type.
  
      Parameters
      ----------
      predictions
          The predictions of the batch. Result of VisionData's batch_to_predictions
      task_type: TaskType
          The task type of the model
      Raises
      ------
      DeepchecksValueError
          If the predictions doesn't fit the required deepchecks format.
      """
      single_image_pred = _validate_predictions_label_common_format(
          "prediction", predictions, task_type
      )
  
      if (
          task_type == TaskType.CLASSIFICATION
          and single_image_pred is not None
      ):
          if (
              not isinstance(single_image_pred, np.ndarray)
              or not isinstance(single_image_pred[0], Number)
              or not 0.99 < np.sum(single_image_pred) < 1.01
          ):
              raise ValidationError(
                  "Classification prediction per image must be a sequence of floats representing "
                  "probabilities per class."
              )
      elif (
          task_type == TaskType.OBJECT_DETECTION
          and single_image_pred is not None
      ):
          error_msg = (
              "Object detection prediction per image must be a sequence of 2D arrays, where each row "
              "has 6 columns: [x_min, y_min, w, h, confidence, class_id]"
          )
          if single_image_pred.shape[1] != 6:
              raise ValidationError(error_msg)
          if np.min(single_image_pred) < 0:
              raise ValidationError(
                  f"Found one of coordinates to be negative, {error_msg}"
              )
          if np.max(single_image_pred[:, 5] % 1) > 0:
              raise ValidationError(
                  f"Class_id must be a positive integer. {error_msg}"
              )
      elif (
          task_type == TaskType.SEMANTIC_SEGMENTATION
          and single_image_pred is not None
      ):
          if len(single_image_pred.shape) != 3:
              raise ValidationError(
                  "Semantic segmentation prediction per image must be a 3D array of shape (C, H, W),"
                  "where H and W are the height and width of the corresponding image, and C is the "
                  "number of classes that can be detected."
              )
          if not 0.99 < np.sum(single_image_pred[:, 0][:, 0]) < 1.01:
              raise ValidationError(
                  "Semantic segmentation prediction per pixel per image should be probabilities per "
                  "each possible class"
              )
  
file_path: deepchecks/deepchecks/vision/vision_data/format_validators.py
imports: from numbers import Number
  from typing import Iterable
  import numpy
  from deepchecks.core.errors import ValidationError
  from deepchecks.vision.vision_data import TaskType
  from deepchecks.vision.vision_data.utils import object_to_numpy, sequence_to_numpy
label_desc: Use image node_id 3 for calling a global function with example usage: validate_predictions_format(predictions, task_type) without return types