class_docstr: Generates instance target only for Panoptic-DeepLab.
  Annotation is assumed to have Cityscapes format.
  
  Args:
      rgb2id (function): Function, panoptic label is encoded in a colored image, this function convert color to the
          corresponding panoptic label.
class_docstr_tok: ["Generates","instance","target","only","for","Panoptic-DeepLab",".","Annotation","is","assumed","to","have","Cityscapes","format",".","Args",":","rgb2id","(","function",")",":","Function",",","panoptic","label","is","encoded","in","a","colored","image",",","this","function","convert","color","to","the","corresponding","panoptic","label","."]
docstr: Generates the instance target.
  
  Args:
      panoptic (np.ndarray): Colored image encoding panoptic label.
  
  Returns:
      A dictionary with fields:
          - instance: Tensor, shape=(H, W). 0 is background. 1, 2, 3 ... is instance, so it is class agnostic.
docstr_tok: ["Generates","the","instance","target",".","Args",":","panoptic","(","np.ndarray",")",":","Colored","image","encoding","panoptic","label",".","Returns",":","A","dictionary","with","fields",":","-","instance",":","Tensor",",","shape=","(","H",",","W",")",".","0","is","background",".","1",",","2",",","3","...","is","instance",",","so","it","is","class","agnostic","."]
code: def __call__(self, panoptic):
      """Generates the instance target.
  
      Args:
          panoptic (np.ndarray): Colored image encoding panoptic label.
  
      Returns:
          A dictionary with fields:
              - instance: Tensor, shape=(H, W). 0 is background. 1, 2, 3 ... is instance, so it is class agnostic.
      """
      panoptic = self.rgb2id(panoptic)
      instance = np.zeros_like(panoptic, dtype=np.int64)
      ids = np.unique(panoptic)
      ins_id = 1
      for i, id in enumerate(ids):
          if id > 1000:
              instance[panoptic == id] = ins_id
              ins_id += 1
  
      return dict(instance=instance)
  
file_path: PaddleSeg/contrib/PanopticDeepLab/transforms/target_transforms.py
imports: import numpy
label_desc: Use image node_id 2 for calling the InstanceTargetGenerator obj's underlying member method code with example usage: obj.__call__(panoptic) and returns: dict