code: def register_all_cityscapes(root):
      for key, (image_dir, gt_dir) in _RAW_CITYSCAPES_SPLITS.items():
          meta = _get_builtin_metadata("cityscapes")
          image_dir = os.path.join(root, image_dir)
          gt_dir = os.path.join(root, gt_dir)
  
          inst_key = key.format(task="instance_seg")
          DatasetCatalog.register(
              inst_key,
              lambda x=image_dir, y=gt_dir: load_cityscapes_instances(
                  x, y, from_json=True, to_polygons=True
              ),
          )
          MetadataCatalog.get(inst_key).set(
              image_dir=image_dir,
              gt_dir=gt_dir,
              evaluator_type="cityscapes_instance",
              **meta,
          )
  
          sem_key = key.format(task="sem_seg")
          DatasetCatalog.register(
              sem_key,
              lambda x=image_dir, y=gt_dir: load_cityscapes_semantic(
                  x, y
              ),
          )
          MetadataCatalog.get(sem_key).set(
              image_dir=image_dir,
              gt_dir=gt_dir,
              evaluator_type="cityscapes_sem_seg",
              ignore_label=255,
              **meta,
          )
  
file_path: detectron2/detectron2/data/datasets/builtin.py
imports: import os
  from detectron2.data import DatasetCatalog, MetadataCatalog
  from .builtin_meta import ADE20K_SEM_SEG_CATEGORIES, _get_builtin_metadata
  from .cityscapes import load_cityscapes_instances, load_cityscapes_semantic
  from .cityscapes_panoptic import register_all_cityscapes_panoptic
  from .coco import load_sem_seg, register_coco_instances
  from .coco_panoptic import register_coco_panoptic, register_coco_panoptic_separated
  from .lvis import get_lvis_instances_meta, register_lvis_instances
  from .pascal_voc import register_pascal_voc
label_desc: Use image node_id 3 for calling a global function with example usage: register_all_cityscapes(root) without return types