class_docstr: Base class for a metric in video task.
  
  The metric first processes each batch of data_samples and predictions,
  and appends the processed results to the results list. Then it
  collects all results together from all ranks if distributed training
  is used. Finally, it computes the metrics of the entire dataset.
  
  A subclass of class:`BaseVideoMetric` should assign a meaningful value
  to the class attribute `default_prefix`. See the argument `prefix` for
  details.
docstr: Evaluate the model performance of the whole dataset after processing
  all batches.
  
  Args:
      size (int): Length of the entire validation dataset.
  
  Returns:
      dict: Evaluation metrics dict on the val dataset. The keys are the
      names of the metrics, and the values are corresponding results.
docstr_tok: ["Evaluate","the","model","performance","of","the","whole","dataset","after","processing","all","batches",".","Args",":","size","(","int",")",":","Length","of","the","entire","validation","dataset",".","Returns",":","dict",":","Evaluation","metrics","dict","on","the","val","dataset",".","The","keys","are","the","names","of","the","metrics",",","and","the","values","are","corresponding","results","."]
code: def evaluate(self, size: int = 1) -> dict:
      """Evaluate the model performance of the whole dataset after processing
      all batches.
  
      Args:
          size (int): Length of the entire validation dataset.
  
      Returns:
          dict: Evaluation metrics dict on the val dataset. The keys are the
          names of the metrics, and the values are corresponding results.
      """
      if len(self.results) == 0:
          warnings.warn(
              f"{self.__class__.__name__} got empty `self.results`. Please "
              "ensure that the processed results are properly added into "
              "`self.results` in `process` method."
          )
  
      results = collect_tracking_results(
          self.results, self.collect_device
      )
  
      if is_main_process():
          _metrics = self.compute_metrics(results)  # type: ignore
          # Add prefix to metric names
          if self.prefix:
              _metrics = {
                  "/".join((self.prefix, k)): v
                  for k, v in _metrics.items()
              }
          metrics = [_metrics]
      else:
          metrics = [None]  # type: ignore
  
      broadcast_object_list(metrics)
  
      # reset the results list
      self.results.clear()
      return metrics[0]
  
file_path: mmdetection/mmdet/evaluation/metrics/base_video_metric.py
imports: import os.path
  import pickle
  import shutil
  import tempfile
  import warnings
  from typing import Optional, Sequence
  import torch
  from mmengine.dist import barrier, broadcast, broadcast_object_list, get_dist_info, is_main_process
  from mmengine.evaluator import BaseMetric
  from mmengine.utils import mkdir_or_exist
label_desc: Use image node_id 2 for calling the BaseVideoMetric obj's underlying member method code with example usage: obj.evaluate(size) and returns: metrics