code: def _create_anno(msk, lb, sc, img_id, anno_id, ar=None, crw=None):
      H, W = msk.shape
      if crw is None:
          crw = False
      msk = np.asfortranarray(msk.astype(np.uint8))
      rle = mask_tools.encode(msk)
      if ar is None:
          # We compute dummy area to pass to pycocotools.
          # Note that area dependent scores are ignored afterwards.
          ar = mask_tools.area(rle)
      if crw is None:
          crw = False
      # Rounding is done to make the result consistent with COCO.
      anno = {
          "image_id": img_id,
          "category_id": lb,
          "segmentation": rle,
          "area": ar,
          "id": anno_id,
          "iscrowd": crw,
      }
      if sc is not None:
          anno.update({"score": sc})
      return anno
  
file_path: chainercv/chainercv/evaluations/eval_instance_segmentation_coco.py
imports: import itertools
  import numpy
  import os
  import six
  from chainercv.evaluations.eval_detection_coco import _redirect_stdout
  from chainercv.evaluations.eval_detection_coco import _summarize
label_desc: Use image node_id 2 for calling a global function with example usage: _create_anno(msk, lb, sc, img_id, anno_id, ar, crw) and returns: anno