code: def image_wise_to_instance_wise(label_img, inst_img):
      mask = []
      label = []
      inst_ids = np.unique(inst_img)
      for inst_id in inst_ids[inst_ids != -1]:
          msk = inst_img == inst_id
          lbl = np.unique(label_img[msk])[0] - 1
  
          assert inst_id != -1
          assert lbl != -1
  
          mask.append(msk)
          label.append(lbl)
      mask = np.array(mask).astype(np.bool)
      label = np.array(label).astype(np.int32)
      return mask, label
  
imports: import filelock
  import numpy
  import os
  from chainer.dataset import download
  from chainercv import utils
label_desc: Use image node_id 2 for calling a global function with example usage: image_wise_to_instance_wise(label_img, inst_img) and returns: mask,  label