docstr: Process one batch of data samples and predictions. The processed
  results should be stored in ``self.results``, which will be used to
  compute the metrics when all batches have been processed.
  
  Args:
      data_batch (dict): A batch of data from the dataloader.
      data_samples (Sequence[dict]): A batch of data samples that
          contain annotations and predictions.
docstr_tok: ["Process","one","batch","of","data","samples","and","predictions",".","The","processed","results","should","be","stored","in","``","self.results","``",",","which","will","be","used","to","compute","the","metrics","when","all","batches","have","been","processed",".","Args",":","data_batch","(","dict",")",":","A","batch","of","data","from","the","dataloader",".","data_samples","(","Sequence","[","dict","]",")",":","A","batch","of","data","samples","that","contain","annotations","and","predictions","."]
code: def process(
      self, data_batch: dict, data_samples: Sequence[dict]
  ) -> None:
      """Process one batch of data samples and predictions. The processed
      results should be stored in ``self.results``, which will be used to
      compute the metrics when all batches have been processed.
  
      Args:
          data_batch (dict): A batch of data from the dataloader.
          data_samples (Sequence[dict]): A batch of data samples that
              contain annotations and predictions.
      """
      cur_results = []
      for data_sample in data_samples:
          pred = data_sample["pred_instances"]
          xmin, ymin, xmax, ymax = pred["bboxes"].cpu().unbind(1)
          boxes = torch.stack(
              (xmin, ymin, xmax - xmin, ymax - ymin), dim=1
          ).tolist()
  
          scores = pred["scores"].cpu().numpy()
          labels = pred["labels"].cpu().numpy()
  
          if len(boxes) == 0:
              continue
  
          cur_results.extend(
              [
                  {
                      "image_id": data_sample["img_id"],
                      "category_id": self.cat_ids[labels[k]],
                      "bbox": box,
                      "score": scores[k],
                  }
                  for k, box in enumerate(boxes)
              ]
          )
  
      by_cat = defaultdict(list)
      for ann in cur_results:
          by_cat[ann["category_id"]].append(ann)
  
      for cat, cat_anns in by_cat.items():
          if cat not in self.results:
              self.results[cat] = []
  
          cur = sorted(
              cat_anns, key=lambda x: x["score"], reverse=True
          )[: self.topk]
          self.results[cat] = _merge_lists(
              self.results[cat],
              cur,
              self.topk,
              key=lambda x: x["score"],
          )
  
imports: import itertools
  import logging
  import os.path
  import tempfile
  import warnings
  from collections import OrderedDict, defaultdict
  from typing import Dict, List, Optional, Sequence, Union
  import numpy
  import torch
  from mmengine.dist import all_gather_object, broadcast_object_list, is_main_process
  from mmengine.evaluator import BaseMetric
  from mmengine.evaluator.metric import _to_cpu
  from mmengine.fileio import get_local_path
  from mmengine.logging import MMLogger, print_log
  from terminaltables import AsciiTable
  from mmdet.registry import METRICS
  from mmdet.structures.mask import encode_mask_results
  from ..functional import eval_recalls
  from .coco_metric import CocoMetric
label_desc: Use image node_id 2 for calling the LVISFixedAPMetric obj's underlying member method code with example usage: obj.process(data_batch, data_samples) without return types