code: def plot_mask_predictions(
      result: Results,
      model_name: str,
      table: Optional[wandb.Table] = None,
  ) -> Tuple[wandb.Image, Dict, Dict, Dict]:
      result = result.to("cpu")
      boxes, masks, mean_confidence_map = get_boxes_and_masks(result)
      image = wandb.Image(
          result.orig_img[:, :, ::-1], boxes=boxes, masks=masks
      )
      if table is not None:
          table.add_data(
              model_name,
              image,
              len(boxes["predictions"]["box_data"]),
              mean_confidence_map,
              result.speed,
          )
          return table
      return image, masks, boxes["predictions"], mean_confidence_map
  
file_path: wandb/wandb/integration/ultralytics/mask_utils.py
imports: from typing import Dict, Optional, Tuple
  import numpy
  from ultralytics.engine.results import Results
  from ultralytics.models.yolo.segment import SegmentationPredictor
  from ultralytics.utils.ops import scale_image
  import wandb
  from .bbox_utils import get_ground_truth_bbox_annotations, get_mean_confidence_map
label_desc: Use image node_id 3 for calling a global function with example usage: plot_mask_predictions(result, model_name, table) and returns: image,  masks,  boxes,  mean_confidence_map, table