code: def _maybe_substitute_metadata(self):
      cont_id_2_cat_id = get_contiguous_id_to_category_id_map(
          self._metadata
      )
      cat_id_2_cont_id = (
          self._metadata.thing_dataset_id_to_contiguous_id
      )
      if len(cont_id_2_cat_id) == len(cat_id_2_cont_id):
          return
  
      cat_id_2_cont_id_injective = {}
      for cat_id, cont_id in cat_id_2_cont_id.items():
          if (cont_id in cont_id_2_cat_id) and (
              cont_id_2_cat_id[cont_id] == cat_id
          ):
              cat_id_2_cont_id_injective[cat_id] = cont_id
  
      metadata_new = Metadata(name=self._metadata.name)
      for key, value in self._metadata.__dict__.items():
          if key == "thing_dataset_id_to_contiguous_id":
              setattr(metadata_new, key, cat_id_2_cont_id_injective)
          else:
              setattr(metadata_new, key, value)
      self._metadata = metadata_new
  
file_path: detectron2/projects/DensePose/densepose/evaluation/d2_evaluator_adapter.py
imports: from detectron2.data.catalog import Metadata
  from detectron2.evaluation import COCOEvaluator
  from densepose.data.datasets.coco import get_contiguous_id_to_category_id_map, maybe_filter_categories_cocoapi
label_desc: Use image node_id 2 for calling the Detectron2COCOEvaluatorAdapter obj's underlying member method code with example usage: obj._maybe_substitute_metadata() without return types