code: def label_quality_score(
      y_pred: torch.Tensor,
      y: torch.Tensor,
      include_background: bool = True,
      scalar_reduction: str = "mean",
  ) -> torch.Tensor | None:
      """
      The assumption is that the DL model makes better predictions than the provided label quality, hence the difference
      can be treated as a label quality score
  
      Args:
          y_pred: Input data of dimension [B, C, H, W, D] or [B, C, H, W] or [B, C, H] where B is Batch-size, C is
              channels and H, W, D stand for Height, Width & Depth
          y: Ground Truth of dimension [B, C, H, W, D] or [B, C, H, W] or [B, C, H] where B is Batch-size, C is channels
              and H, W, D stand for Height, Width & Depth
          include_background: Whether to include the background of the spatial image or channel 0 of the 1-D vector
          scalar_reduction: reduction type of the metric, either 'sum' or 'mean' can be used to retrieve a single scalar
              value, if set to 'none' a spatial map will be returned
  
      Returns:
          A single scalar absolute difference value as score with a reduction based on sum/mean or the spatial map of
          absolute difference
      """
  
      # The background utils is only applicable here because instead of Batch-dimension we have repeats here
      y_pred = y_pred.float()
      y = y.float()
  
      if not include_background:
          y_pred, y = ignore_background(y_pred=y_pred, y=y)
  
      n_len = len(y_pred.shape)
      if n_len < 4 and scalar_reduction == "none":
          warnings.warn(
              "Reduction set to None, Spatial map return requires a 2D/3D image of B-Batchsize and C-channels"
          )
          return None
  
      abs_diff_map = torch.abs(y_pred - y)
  
      if scalar_reduction == MetricReduction.NONE:
          return abs_diff_map
  
      if scalar_reduction == MetricReduction.MEAN:
          return torch.mean(abs_diff_map, dim=list(range(1, n_len)))
      if scalar_reduction == MetricReduction.SUM:
          return torch.sum(abs_diff_map, dim=list(range(1, n_len)))
      raise ValueError(
          f"scalar_reduction={scalar_reduction} not supported."
      )
  
file_path: MONAI/monai/metrics/active_learning_metrics.py
imports: from __future__ import annotations
  import warnings
  from typing import Any
  import torch
  from monai.metrics.utils import ignore_background
  from monai.utils import MetricReduction
  from .metric import Metric
label_desc: Use image node_id 2 for calling a global function with example usage: label_quality_score(y_pred, y, include_background, scalar_reduction) and returns: None, abs_diff_map, torch, torch