docstr: Initialize the test pipeline.
docstr_tok: ["Initialize","the","test","pipeline","."]
code: def _init_pipeline(self, cfg: ConfigType) -> Compose:
      """Initialize the test pipeline."""
      pipeline_cfg = cfg.test_dataloader.dataset.pipeline
  
      # For inference, the key of ``img_id`` is not used.
      if "meta_keys" in pipeline_cfg[-1]:
          pipeline_cfg[-1]["meta_keys"] = tuple(
              meta_key
              for meta_key in pipeline_cfg[-1]["meta_keys"]
              if meta_key != "img_id"
          )
  
      load_img_idx = self._get_transform_idx(
          pipeline_cfg, "LoadImageFromFile"
      )
      if load_img_idx == -1:
          raise ValueError(
              "LoadImageFromFile is not found in the test pipeline"
          )
      pipeline_cfg[load_img_idx]["type"] = "mmdet.InferencerLoader"
  
      retrieval_pipeline = Compose(pipeline_cfg)
  
      grounding_pipeline_cp = copy.deepcopy(pipeline_cfg)
      grounding_pipeline_cp[1].scale = cfg.grounding_scale
      grounding_pipeline = Compose(grounding_pipeline_cp)
  
      return {
          "grounding_pipeline": grounding_pipeline,
          "retrieval_pipeline": retrieval_pipeline,
      }
  
file_path: mmdetection/projects/XDecoder/xdecoder/inference/texttoimage_regionretrieval_inferencer.py
imports: import copy
  from typing import Iterable, Optional, Union
  import torch
  from mmengine.dataset import Compose
  from rich.progress import track
  from mmdet.apis.det_inferencer import DetInferencer, InputsType
  from mmdet.utils import ConfigType
label_desc: Use image node_id 1 for calling the TextToImageRegionRetrievalInferencer obj's underlying member method code with example usage: obj._init_pipeline(cfg) and returns: dict