class_docstr: The dataloader benchmark class. It will be statistical inference FPS and
  CPU memory information.
  
  Args:
      cfg (mmengine.Config): config.
      distributed (bool): distributed testing flag.
      dataset_type (str): benchmark data type, only supports ``train``,
          ``val`` and ``test``.
      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","dataloader","benchmark","class",".","It","will","be","statistical","inference","FPS","and","CPU","memory","information",".","Args",":","cfg","(","mmengine.Config",")",":","config",".","distributed","(","bool",")",":","distributed","testing","flag",".","dataset_type","(","str",")",":","benchmark","data","type",",","only","supports","``","train","``",",","``","val","``","and","``","test","``",".","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","."]
code: def __init__(
      self,
      cfg: Config,
      distributed: bool,
      dataset_type: str,
      max_iter: int = 2000,
      log_interval: int = 50,
      num_warmup: int = 5,
      logger: Optional[MMLogger] = None,
  ):
      super().__init__(max_iter, log_interval, num_warmup, logger)
  
      assert dataset_type in ["train", "val", "test"], (
          "dataset_type only supports train,"
          f" val and test, but got {dataset_type}"
      )
      assert (
          get_world_size() == 1
      ), "Dataloader benchmark does not allow distributed multi-GPU"
  
      self.cfg = copy.deepcopy(cfg)
      self.distributed = distributed
  
      if psutil is None:
          raise ImportError(
              "psutil is not installed, please install it by: "
              "pip install psutil"
          )
      self._process = psutil.Process()
  
      mp_cfg = self.cfg.get("env_cfg", {}).get("mp_cfg")
      if mp_cfg is not None:
          set_multi_processing(distributed=self.distributed, **mp_cfg)
      else:
          set_multi_processing(distributed=self.distributed)
  
      print_log("before build: ", self.logger)
      print_process_memory(self._process, self.logger)
  
      if dataset_type == "train":
          self.data_loader = Runner.build_dataloader(
              cfg.train_dataloader
          )
      elif dataset_type == "test":
          self.data_loader = Runner.build_dataloader(
              cfg.test_dataloader
          )
      else:
          self.data_loader = Runner.build_dataloader(cfg.val_dataloader)
  
      self.batch_size = self.data_loader.batch_size
      self.num_workers = self.data_loader.num_workers
  
      print_log("after build: ", self.logger)
      print_process_memory(self._process, self.logger)
  
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 1 to create a new DataLoaderBenchmark object from inherited base classes: BaseBenchmark with example: obj = DataLoaderBenchmark(cfg, distributed, dataset_type, max_iter, log_interval, num_warmup, logger)