code: def load_img_info(files):
      img_file, inst_file, segm_file = files
      inst_img = mmcv.imread(inst_file, "unchanged")
      # ids < 24 are stuff labels (filtering them first is about 5% faster)
      unique_inst_ids = np.unique(inst_img[inst_img >= 24])
      anno_info = []
      for inst_id in unique_inst_ids:
          # For non-crowd annotations, inst_id // 1000 is the label_id
          # Crowd annotations have <1000 instance ids
          label_id = inst_id // 1000 if inst_id >= 1000 else inst_id
          label = CSLabels.id2label[label_id]
          if not label.hasInstances or label.ignoreInEval:
              continue
  
          category_id = label.id
          iscrowd = int(inst_id < 1000)
          mask = np.asarray(
              inst_img == inst_id, dtype=np.uint8, order="F"
          )
          mask_rle = maskUtils.encode(mask[:, :, None])[0]
  
          area = maskUtils.area(mask_rle)
          # convert to COCO style XYWH format
          bbox = maskUtils.toBbox(mask_rle)
  
          # for json encoding
          mask_rle["counts"] = mask_rle["counts"].decode()
  
          anno = dict(
              iscrowd=iscrowd,
              category_id=category_id,
              bbox=bbox.tolist(),
              area=area.tolist(),
              segmentation=mask_rle,
          )
          anno_info.append(anno)
      video_name = osp.basename(osp.dirname(img_file))
      img_info = dict(
          # remove img_prefix for filename
          file_name=osp.join(video_name, osp.basename(img_file)),
          height=inst_img.shape[0],
          width=inst_img.shape[1],
          anno_info=anno_info,
          segm_file=osp.join(video_name, osp.basename(segm_file)),
      )
  
      return img_info
  
file_path: mmdetection/tools/dataset_converters/cityscapes.py
imports: import argparse
  import glob
  import os.path
  import cityscapesscripts.helpers.labels
  import mmcv
  import numpy
  import pycocotools.mask
  from mmengine.fileio import dump
  from mmengine.utils import Timer, mkdir_or_exist, track_parallel_progress, track_progress
label_desc: Use image node_id 3 for calling a global function with example usage: load_img_info(files) and returns: img_info