class_docstr: Coco Caption evaluation wrapper.
  
  Save the generated captions and transform into coco format.
  Calling COCO API for caption metrics.
  
  Args:
      ann_file (str): the path for the COCO format caption ground truth
          json file, load for evaluations.
      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. Should be modified according to the
          `retrieval_type` for unambiguous results. Defaults to TR.
class_docstr_tok: ["Coco","Caption","evaluation","wrapper",".","Save","the","generated","captions","and","transform","into","coco","format",".","Calling","COCO","API","for","caption","metrics",".","Args",":","ann_file","(","str",")",":","the","path","for","the","COCO","format","caption","ground","truth","json","file",",","load","for","evaluations",".","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",".","Should","be","modified","according","to","the","`","retrieval_type","`","for","unambiguous","results",".","Defaults","to","TR","."]
code: def __init__(
      self,
      ann_file: str,
      collect_device: str = "cpu",
      prefix: Optional[str] = None,
  ):
      if COCOEvalCap is None:
          raise RuntimeError(
              "COCOEvalCap is not installed, please install it by: "
              "pip install pycocoevalcap"
          )
  
      super().__init__(collect_device=collect_device, prefix=prefix)
      self.ann_file = ann_file
  
file_path: mmdetection/mmdet/evaluation/metrics/coco_caption_metric.py
imports: import json
  import os
  import tempfile
  from typing import List, Optional
  from mmengine.evaluator import BaseMetric
  from mmengine.utils import track_iter_progress
  from pycocotools.coco import COCO
  from mmdet.registry import METRICS
label_desc: Use image node_id 1 to create a new COCOCaptionMetric object from inherited base classes: BaseMetric with example: obj = COCOCaptionMetric(ann_file, collect_device, prefix)