code: def main():
      args = parse_args()
      cfg = Config.fromfile(args.config)
      if args.cfg_options is not None:
          cfg.merge_from_dict(args.cfg_options)
  
      # register all modules in mmdet into the registries
      init_default_scope(cfg.get("default_scope", "mmdet"))
  
      dataset = DATASETS.build(cfg.train_dataloader.dataset)
      visualizer = VISUALIZERS.build(cfg.visualizer)
      visualizer.dataset_meta = dataset.metainfo
  
      progress_bar = ProgressBar(len(dataset))
      for item in dataset:
          img = item["inputs"].permute(1, 2, 0).numpy()
          data_sample = item["data_samples"].numpy()
          gt_instances = data_sample.gt_instances
          img_path = osp.basename(item["data_samples"].img_path)
  
          out_file = (
              osp.join(args.output_dir, osp.basename(img_path))
              if args.output_dir is not None
              else None
          )
  
          img = img[..., [2, 1, 0]]  # bgr to rgb
          gt_bboxes = gt_instances.get("bboxes", None)
          if gt_bboxes is not None and isinstance(gt_bboxes, BaseBoxes):
              gt_instances.bboxes = gt_bboxes.tensor
          gt_masks = gt_instances.get("masks", None)
          if gt_masks is not None:
              masks = mask2ndarray(gt_masks)
              gt_instances.masks = masks.astype(bool)
          data_sample.gt_instances = gt_instances
  
          visualizer.add_datasample(
              osp.basename(img_path),
              img,
              data_sample,
              draw_pred=False,
              show=not args.not_show,
              wait_time=args.show_interval,
              out_file=out_file,
          )
  
          progress_bar.update()
  
file_path: mmdetection/tools/analysis_tools/browse_dataset.py
imports: import argparse
  import os.path
  from mmengine.config import Config, DictAction
  from mmengine.registry import init_default_scope
  from mmengine.utils import ProgressBar
  from mmdet.models.utils import mask2ndarray
  from mmdet.registry import DATASETS, VISUALIZERS
  from mmdet.structures.bbox import BaseBoxes
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types