code: def instance_mask_to_semantic_mask(instance_mask, class_indices):
      height, width, num_instances = instance_mask.shape
      semantic_mask = np.zeros((height, width), dtype=np.uint8)
      for i in range(num_instances):
          instance_map = instance_mask[:, :, i]
          class_index = class_indices[i]
          semantic_mask[instance_map == 1] = class_index
      return semantic_mask
  
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 1 for calling a global function with example usage: instance_mask_to_semantic_mask(instance_mask, class_indices) and returns: semantic_mask