code: def id2trainId(self, label, reverse=False, ignore_label=255):
      label_copy = ignore_label * np.ones(label.shape, dtype=np.float32)
      for k, v in self.id_to_trainid.items():
          label_copy[label == k] = v
      if self.class_16:
          label_copy_16 = ignore_label * np.ones(
              label.shape, dtype=np.float32
          )
          for k, v in self.trainid_to_16id.items():
              label_copy_16[label_copy == k] = v
          label_copy = label_copy_16
      if self.class_13:
          label_copy_13 = ignore_label * np.ones(
              label.shape, dtype=np.float32
          )
          for k, v in self.trainid_to_13id.items():
              label_copy_13[label_copy == k] = v
          label_copy = label_copy_13
      return label_copy
  
file_path: PaddleSeg/contrib/DomainAdaptation/datasets/cityscapes_noconfig.py
imports: import os
  import random
  import numpy
  import collections.abc
  from PIL import Image, ImageOps, ImageFilter, ImageFile
  import paddle
  from paddle import io
  import paddleseg.transforms.functional
label_desc: Use image node_id 2 for calling the CityDataset obj's underlying member method code with example usage: obj.id2trainId(label, reverse, ignore_label) and returns: label_copy