code: def _compute_swap_box_scores_for_image(
      alpha: float,
      high_probability_threshold: float,
      label: Optional[Dict[str, Any]] = None,
      prediction: Optional[np.ndarray] = None,
      pred_labels: Optional[np.ndarray] = None,
      pred_label_probs: Optional[np.ndarray] = None,
      pred_bboxes: Optional[np.ndarray] = None,
      lab_labels: Optional[np.ndarray] = None,
      lab_bboxes: Optional[np.ndarray] = None,
      similarity_matrix: Optional[np.ndarray] = None,
      iou_matrix: Optional[np.ndarray] = None,
      min_possible_similarity: Optional[float] = None,
      overlapping_label_check: Optional[bool] = True,
  ) -> np.ndarray:
      """This method returns one score per labeled box in an image. Score from 0 to 1 ranking how likeley swapped the box is."""
  
      auxiliary_input_dict = (
          _get_valid_inputs_for_compute_scores_per_image(
              alpha=alpha,
              label=label,
              prediction=prediction,
              pred_labels=pred_labels,
              pred_label_probs=pred_label_probs,
              pred_bboxes=pred_bboxes,
              lab_labels=lab_labels,
              lab_bboxes=lab_bboxes,
              similarity_matrix=similarity_matrix,
              min_possible_similarity=min_possible_similarity,
          )
      )
  
      pred_labels = auxiliary_input_dict["pred_labels"]
      pred_label_probs = auxiliary_input_dict["pred_label_probs"]
      lab_labels = auxiliary_input_dict["lab_labels"]
      similarity_matrix = auxiliary_input_dict["similarity_matrix"]
      min_possible_similarity = auxiliary_input_dict[
          "min_possible_similarity"
      ]
  
      if overlapping_label_check:
          has_overlap_label_bboxes = _has_overlap(
              lab_bboxes, lab_labels
          )
      else:
          has_overlap_label_bboxes = np.array([False] * len(lab_labels))
  
      scores_swap = np.empty(len(lab_labels))
  
      for iid, k in enumerate(lab_labels):
          not_k_idx = np.where(pred_labels != k)[0]
          if has_overlap_label_bboxes[iid]:
              scores_swap[iid] = min_possible_similarity
              continue
          if not_k_idx.size == 0 or np.all(
              pred_label_probs[not_k_idx] <= high_probability_threshold
          ):
              scores_swap[iid] = 1.0
              continue
  
          not_k_pred = pred_label_probs[not_k_idx]
          idx_at_least_high_probability_threshold = np.where(
              not_k_pred > high_probability_threshold
          )[0]
          not_k_similarity = similarity_matrix[iid, not_k_idx][
              idx_at_least_high_probability_threshold
          ]
  
          closest_predicted_box = np.argmax(not_k_similarity)
          score = np.max(
              [
                  min_possible_similarity,
                  1 - not_k_similarity[closest_predicted_box],
              ]
          )
          scores_swap[iid] = score
  
      return scores_swap
  
imports: import warnings
  from cleanlab.internal.constants import ALPHA, CUSTOM_SCORE_WEIGHT_BADLOC, CUSTOM_SCORE_WEIGHT_OVERLOOKED, CUSTOM_SCORE_WEIGHT_SWAP, EUC_FACTOR, HIGH_PROBABILITY_THRESHOLD, LOW_PROBABILITY_THRESHOLD, MAX_ALLOWED_BOX_PRUNE, TINY_VALUE, TEMPERATURE, LABEL_OVERLAP_THRESHOLD
  import copy
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, TypeVar
  import numpy
  from cleanlab.internal.object_detection_utils import softmin1d, assert_valid_aggregation_weights, assert_valid_inputs
label_desc: Use image node_id 28 for calling a global function with example usage: _compute_swap_box_scores_for_image(alpha, high_probability_threshold, label, prediction, pred_labels, pred_label_probs, pred_bboxes, lab_labels, lab_bboxes, similarity_matrix, iou_matrix, min_possible_similarity, overlapping_label_check) and returns: scores_swap