code: def getGtInstances(
      groundtruth_list: list,
      args: CArgs,
      backend_args: Optional[dict] = None,
  ) -> dict:
      """A wrapper of obj:``cityscapesscripts.evaluation.
  
      evalInstanceLevelSemanticLabeling.getGtInstances``. Support loading
      groundtruth image from file backend.
      Args:
          groundtruth_list (list): A list of groundtruth image file.
          args (CArgs): A global object setting in
              obj:``cityscapesscripts.evaluation.
              evalInstanceLevelSemanticLabeling``
          backend_args (dict, optional): Arguments to instantiate the
              preifx of uri corresponding backend. Defaults to None.
      Returns:
          dict: The computed metric.
      """
      if not HAS_CITYSCAPESAPI:
          raise RuntimeError(
              "Failed to import `cityscapesscripts`."
              "Please try to install official "
              "cityscapesscripts by "
              '"pip install cityscapesscripts"'
          )
      # if there is a global statistics json, then load it
      if os.path.isfile(args.gtInstancesFile):
          if not args.quiet:
              print("Loading ground truth instances from JSON.")
          with open(args.gtInstancesFile) as json_file:
              gt_instances = json.load(json_file)
      # otherwise create it
      else:
          if not args.quiet:
              print("Creating ground truth instances from png files.")
          gt_instances = instances2dict(
              groundtruth_list, args, backend_args=backend_args
          )
          writeDict2JSON(gt_instances, args.gtInstancesFile)
  
      return gt_instances
  
file_path: mmdetection/mmdet/evaluation/functional/cityscapes_utils.py
imports: import json
  import os
  import sys
  from pathlib import Path
  from typing import Optional, Union
  import mmcv
  import numpy
  from mmengine.fileio import get
label_desc: Use image node_id 5 for calling a global function with example usage: getGtInstances(groundtruth_list, args, backend_args) and returns: gt_instances