code: def load_cityscapes_semantic(image_dir, gt_dir):
      """
      Args:
          image_dir (str): path to the raw dataset. e.g., "~/cityscapes/leftImg8bit/train".
          gt_dir (str): path to the raw annotations. e.g., "~/cityscapes/gtFine/train".
  
      Returns:
          list[dict]: a list of dict, each has "file_name" and
              "sem_seg_file_name".
      """
      ret = []
      # gt_dir is small and contain many small files. make sense to fetch to local first
      gt_dir = PathManager.get_local_path(gt_dir)
      for image_file, _, label_file, json_file in _get_cityscapes_files(
          image_dir, gt_dir
      ):
          label_file = label_file.replace("labelIds", "labelTrainIds")
  
          with PathManager.open(json_file, "r") as f:
              jsonobj = json.load(f)
          ret.append(
              {
                  "file_name": image_file,
                  "sem_seg_file_name": label_file,
                  "height": jsonobj["imgHeight"],
                  "width": jsonobj["imgWidth"],
              }
          )
      assert len(ret), f"No images found in {image_dir}!"
      assert PathManager.isfile(
          ret[0]["sem_seg_file_name"]
      ), "Please generate labelTrainIds.png with cityscapesscripts/preparation/createTrainIdLabelImgs.py"  # noqa
      return ret
  
file_path: detectron2/detectron2/data/datasets/cityscapes.py
imports: import functools
  import json
  import logging
  import multiprocessing
  import numpy
  import os
  from itertools import chain
  import pycocotools.mask
  from PIL import Image
  from detectron2.structures import BoxMode
  from detectron2.utils.comm import get_world_size
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.logger import setup_logger
label_desc: Use image node_id 3 for calling a global function with example usage: load_cityscapes_semantic(image_dir, gt_dir) and returns: ret