code: def run_rai_insights(
      model,
      test_data,
      target_column,
      task_type,
      classes=None,
      test_explainer=False,
      test_error_analysis=False,
      image_mode=None,
      dropped_features=None,
      upscale=False,
      max_evals=DEFAULT_MAX_EVALS,
      num_masks=DEFAULT_NUM_MASKS,
      mask_res=DEFAULT_MASK_RES,
      device=Device.AUTO.value,
      ignore_index=False,
  ):
      feature_metadata = None
      if dropped_features:
          feature_metadata = FeatureMetadata(
              dropped_features=dropped_features
          )
      image_width = None
      if upscale:
          image_width = 2
      rai_insights = RAIVisionInsights(
          model,
          test_data,
          target_column,
          task_type=task_type,
          classes=classes,
          image_mode=image_mode,
          feature_metadata=feature_metadata,
          image_width=image_width,
          max_evals=max_evals,
          num_masks=num_masks,
          mask_res=mask_res,
          device=device,
      )
      # Note: this seems too resource-intensive
      # TODO: re-add when we get beefier test machines
      if test_explainer:
          rai_insights.explainer.add()
      if test_error_analysis:
          rai_insights.error_analysis.add()
      if test_explainer or test_error_analysis:
          rai_insights.compute()
      rai_insights.get_data()
      # Validate
      validate_rai_vision_insights(
          rai_insights,
          test_data,
          target_column,
          task_type,
          ignore_index,
      )
      if task_type == ModelTask.OBJECT_DETECTION:
          selection_indexes = [[0]]
          class_name = classes[0]
          iou_threshold = 70
          object_detection_cache = {}
          aggregate_methods = ["macro", "micro"]
          for aggregate_method in aggregate_methods:
              metrics = rai_insights.compute_object_detection_metrics(
                  selection_indexes,
                  aggregate_method,
                  class_name,
                  iou_threshold,
                  object_detection_cache,
              )
              assert len(metrics) == 2
  
imports: import sys
  import numpy
  import PIL
  import pytest
  from common_vision_utils import FRIDGE_MULTILABEL_TARGETS, ImageTransformEnum, ImageTransforms, create_dummy_model, create_image_classification_pipeline, create_pytorch_vision_model, gridify_fridge_multilabel_labels, load_flowers_dataset, load_fridge_dataset, load_fridge_object_detection_dataset, load_imagenet_dataset, load_imagenet_labels, load_mnist_dataset, load_multilabel_fridge_dataset, retrieve_fridge_object_detection_model, retrieve_or_train_fridge_model
  from ml_wrappers import wrap_model
  from ml_wrappers.common.constants import Device
  from rai_vision_insights_validator import validate_rai_vision_insights
  from responsibleai.feature_metadata import FeatureMetadata
  from responsibleai_vision import ModelTask, RAIVisionInsights
  from responsibleai_vision.common.constants import ExplainabilityDefaults, ImageColumns, ImageModes
label_desc: Use image node_id 1 for calling a global function with example usage: run_rai_insights(model, test_data, target_column, task_type, classes, test_explainer, test_error_analysis, image_mode, dropped_features, upscale, max_evals, num_masks, mask_res, device, ignore_index) without return types