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","."]
docstr: Compute the metrics from processed results.
  
  Args:
      results (dict): The processed results of each batch.
  
  Returns:
      Dict: The computed metrics. The keys are the names of the metrics,
      and the values are corresponding results.
docstr_tok: ["Compute","the","metrics","from","processed","results",".","Args",":","results","(","dict",")",":","The","processed","results","of","each","batch",".","Returns",":","Dict",":","The","computed","metrics",".","The","keys","are","the","names","of","the","metrics",",","and","the","values","are","corresponding","results","."]
code: def compute_metrics(self, results: List):
      """Compute the metrics from processed results.
  
      Args:
          results (dict): The processed results of each batch.
  
      Returns:
          Dict: The computed metrics. The keys are the names of the metrics,
          and the values are corresponding results.
      """
      # NOTICE: don't access `self.results` from the method.
  
      with tempfile.TemporaryDirectory() as temp_dir:
          eval_result_file = save_result(
              result=results,
              result_dir=temp_dir,
              filename="caption_pred",
              remove_duplicate="image_id",
          )
  
          coco_val = coco_caption_eval(eval_result_file, self.ann_file)
  
      return coco_val
  
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 3 for calling the COCOCaptionMetric obj's underlying member method code with example usage: obj.compute_metrics(results) and returns: coco_val