class_docstr: Dump proposals pseudo metric.
  
  Args:
      output_dir (str): The root directory for ``proposals_file``.
          Defaults to ''.
      proposals_file (str): Proposals file path. Defaults to 'proposals.pkl'.
      num_max_proposals (int, optional): Maximum number of proposals to dump.
          If not specified, all proposals will be dumped.
      file_client_args (dict, optional): Arguments to instantiate the
          corresponding backend in mmdet <= 3.0.0rc6. Defaults to None.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
      collect_device (str): Device name used for collecting results from
          different ranks during distributed training. Must be 'cpu' or
          'gpu'. Defaults to 'cpu'.
      prefix (str, optional): The prefix that will be added in the metric
          names to disambiguate homonymous metrics of different evaluators.
          If prefix is not provided in the argument, self.default_prefix
          will be used instead. Defaults to None.
code: def __init__(
      self,
      output_dir: str = "",
      proposals_file: str = "proposals.pkl",
      num_max_proposals: Optional[int] = None,
      file_client_args: dict = None,
      backend_args: dict = None,
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ) -> None:
      super().__init__(collect_device=collect_device, prefix=prefix)
      self.num_max_proposals = num_max_proposals
      # TODO: update after mmengine finish refactor fileio.
      self.backend_args = backend_args
      if file_client_args is not None:
          raise RuntimeError(
              "The `file_client_args` is deprecated, "
              "please use `backend_args` instead, please refer to"
              "https://github.com/open-mmlab/mmdetection/blob/main/configs/_base_/datasets/coco_detection.py"  # noqa: E501
          )
      self.output_dir = output_dir
      assert proposals_file.endswith(
          (".pkl", ".pickle")
      ), "The output file must be a pkl file."
  
      self.proposals_file = os.path.join(
          self.output_dir, proposals_file
      )
      if is_main_process():
          os.makedirs(self.output_dir, exist_ok=True)
  
file_path: mmdetection/mmdet/evaluation/metrics/dump_proposals_metric.py
imports: import os
  import os.path
  from typing import Optional, Sequence
  from mmengine.dist import is_main_process
  from mmengine.evaluator import BaseMetric
  from mmengine.fileio import dump
  from mmengine.logging import MMLogger
  from mmengine.structures import InstanceData
  from mmdet.registry import METRICS
label_desc: Use image node_id 1 to create a new DumpProposals object from inherited base classes: BaseMetric with example: obj = DumpProposals(output_dir, proposals_file, num_max_proposals, file_client_args, backend_args, collect_device, prefix)