code: def generate_openimages_disentangle_analysis(
      common_map,
      openimages_miap_predictions,
      topk=1,
      confidence_threshold=0.0,
      DISPARATE_THRESHOLD=0.8,
      DISPARATE_LABELS_LIST=None,
      LABEL_ASSOC_MAPPING=None,
  ):
      DISPARATE_LABELS_LIST = DISPARATE_LABELS_LIST or []
      LABEL_ASSOC_MAPPING = LABEL_ASSOC_MAPPING or {}
      openimages_miap_predictions.update(common_map)
      print(
          f"======================== {openimages_miap_predictions['model_name']} ============================"
      )
      class_to_label_name_map = load_file(
          "https://dl.fbaipublicfiles.com/vissl/fairness/label_association/in22k_cls_name_to_label_name_map.json"
      )
      in22k_subset_label_name_map = {
          key: value[0]
          for key, value in class_to_label_name_map.items()
      }
      (
          output_metadata,
          label_to_id,
      ) = load_in22k_subset_opeinimages_miap_labels_images_preds_metadata(
          openimages_miap_predictions,
          confidence_threshold=confidence_threshold,
      )
  
      (
          sorted_output_attributes_pred_freq_map,
          output_attributes_count_map,
          output_attributes_pred_rate_difference_map,
          output_attributes_img_map,
          attribute_label_assoc_map,
          output_attributes_confidence_score_map,
          output_mean_attributes_confidence_score_map,
          output_attributes_label_assoc_conf_scores_map,
          output_attribute_disparate_label_map,
      ) = get_per_attribute_predictions_freq(
          output_metadata,
          label_to_id,
          LABEL_ASSOC_MAPPING,
          DISPARATE_LABELS_LIST,
          DISPARATE_THRESHOLD,
          in22k_subset_label_name_map,
          topk=topk,
      )
  
      _ = convert_and_print_dataframe(
          attribute_label_assoc_map,
          openimages_miap_predictions["model_name"],
          label_assoc_mapping=LABEL_ASSOC_MAPPING,
          threshold=confidence_threshold,
          topk=topk,
      )
      return (
          output_attributes_img_map,
          output_metadata,
          attribute_label_assoc_map,
      )
  
file_path: vissl/projects/fairness_indicators/harmful_label_associations/inference_label_assoc_openimages_miap_test.py
imports: import matplotlib.pyplot
  import numpy
  import pandas
  import torchvision.transforms
  from fvcore.common.file_io import PathManager
  from PIL import Image
  from vissl.utils.io import load_file
label_desc: Use image node_id 9 for calling a global function with example usage: generate_openimages_disentangle_analysis(common_map, openimages_miap_predictions, topk, confidence_threshold, DISPARATE_THRESHOLD, DISPARATE_LABELS_LIST, LABEL_ASSOC_MAPPING) and returns: output_attributes_img_map,  output_metadata,  attribute_label_assoc_map