class_docstr: The inference benchmark class. It will be statistical inference FPS,
  CUDA memory and CPU memory information.
  
  Args:
      cfg (mmengine.Config): config.
      checkpoint (str): Accept local filepath, URL, ``torchvision://xxx``,
          ``open-mmlab://xxx``.
      distributed (bool): distributed testing flag.
      is_fuse_conv_bn (bool): Whether to fuse conv and bn, this will
          slightly increase the inference speed.
      max_iter (int): maximum iterations of benchmark. Defaults to 2000.
      log_interval (int): interval of logging. Defaults to 50.
      num_warmup (int): Number of Warmup. Defaults to 5.
      logger (MMLogger, optional): Formatted logger used to record messages.
class_docstr_tok: ["The","inference","benchmark","class",".","It","will","be","statistical","inference","FPS",",","CUDA","memory","and","CPU","memory","information",".","Args",":","cfg","(","mmengine.Config",")",":","config",".","checkpoint","(","str",")",":","Accept","local","filepath",",","URL",",","``","torchvision",":","\/\/xxx","``",",","``","open-mmlab",":","\/\/xxx","``",".","distributed","(","bool",")",":","distributed","testing","flag",".","is_fuse_conv_bn","(","bool",")",":","Whether","to","fuse","conv","and","bn",",","this","will","slightly","increase","the","inference","speed",".","max_iter","(","int",")",":","maximum","iterations","of","benchmark",".","Defaults","to","2000.","log_interval","(","int",")",":","interval","of","logging",".","Defaults","to","50.","num_warmup","(","int",")",":","Number","of","Warmup",".","Defaults","to","5.","logger","(","MMLogger",",","optional",")",":","Formatted","logger","used","to","record","messages","."]
docstr: Executes the benchmark once.
docstr_tok: ["Executes","the","benchmark","once","."]
code: def run_once(self) -> dict:
      """Executes the benchmark once."""
      pure_inf_time = 0
      fps = 0
  
      for i, data in enumerate(self.data_loader):
          if (i + 1) % self.log_interval == 0:
              print_log(
                  "==================================", self.logger
              )
  
          torch.cuda.synchronize()
          start_time = time.perf_counter()
  
          with torch.no_grad():
              self.model.test_step(data)
  
          torch.cuda.synchronize()
          elapsed = time.perf_counter() - start_time
  
          if i >= self.num_warmup:
              pure_inf_time += elapsed
              if (i + 1) % self.log_interval == 0:
                  fps = (i + 1 - self.num_warmup) / pure_inf_time
                  cuda_memory = get_max_cuda_memory()
  
                  print_log(
                      f"Done image [{i + 1:<3}/{self.max_iter}], "
                      f"fps: {fps:.1f} img/s, "
                      f"times per image: {1000 / fps:.1f} ms/img, "
                      f"cuda memory: {cuda_memory} MB",
                      self.logger,
                  )
                  print_process_memory(self._process, self.logger)
  
          if (i + 1) == self.max_iter:
              fps = (i + 1 - self.num_warmup) / pure_inf_time
              break
  
      return {"fps": fps}
  
imports: import copy
  import time
  from functools import partial
  from typing import List, Optional, Union
  import numpy
  import torch
  import torch.nn
  from mmcv.cnn import fuse_conv_bn
  from mmengine import MMLogger
  from mmengine.config import Config
  from mmengine.device import get_max_cuda_memory
  from mmengine.dist import get_world_size
  from mmengine.runner import Runner, load_checkpoint
  from mmengine.utils.dl_utils import set_multi_processing
  from torch.nn.parallel import DistributedDataParallel
  from mmdet.registry import DATASETS, MODELS
label_desc: Use image node_id 3 for calling the InferenceBenchmark obj's underlying member method code with example usage: obj.run_once() and returns: dict