code: def main():
      args = parse_args()
      assert args.out.endswith(
          "pkl"
      ), "The output file name must be pkl suffix"
  
      # load config files
      cfg = Config.fromfile(args.config)
      dataloader_cfg = cfg.get(f"{args.dataset}_dataloader")
      ann_file = osp.join(
          dataloader_cfg.dataset.data_root,
          dataloader_cfg.dataset.ann_file,
      )
      img_prefix = osp.join(
          dataloader_cfg.dataset.data_root,
          dataloader_cfg.dataset.data_prefix["img"],
      )
  
      print(f'{"-" * 5} Start Processing {"-" * 5}')
      if ann_file.endswith("csv"):
          data_infos = get_metas_from_csv_style_ann_file(ann_file)
      elif ann_file.endswith("txt"):
          data_infos = get_metas_from_txt_style_ann_file(ann_file)
      else:
          shuffix = ann_file.split(".")[-1]
          raise NotImplementedError(
              "File name must be csv or txt suffix but "
              f"get {shuffix}"
          )
  
      print(f"Successfully load annotation file from {ann_file}")
      print(f"Processing {len(data_infos)} images...")
      pool = Pool(args.nproc)
      # get image metas with multiple processes
      image_metas = pool.starmap(
          get_image_metas,
          zip(data_infos, [img_prefix for _ in range(len(data_infos))]),
      )
      pool.close()
  
      # save image metas
      root_path = dataloader_cfg.dataset.ann_file.rsplit("/", 1)[0]
      save_path = osp.join(root_path, args.out)
      dump(image_metas, save_path, protocol=4)
      print(f"Image meta file save to: {save_path}")
  
file_path: mmdetection/tools/misc/get_image_metas.py
imports: import argparse
  import csv
  import os.path
  from multiprocessing import Pool
  import mmcv
  from mmengine.config import Config
  from mmengine.fileio import dump, get
label_desc: Use image node_id 5 for calling a global function with example usage: main() without return types