docstr: Convert annotation which can be polygons, uncompressed RLE to RLE.
  
  :return: binary mask (numpy 2D array)
docstr_tok: ["Convert","annotation","which","can","be","polygons",",","uncompressed","RLE","to","RLE",".",":","return",":","binary","mask","(","numpy","2D","array",")"]
code: def annToRLE(self, ann, frameId):
      """Convert annotation which can be polygons, uncompressed RLE to RLE.
  
      :return: binary mask (numpy 2D array)
      """
      t = self.vids[ann["video_id"]]
      h, w = t["height"], t["width"]
      segm = ann["segmentations"][frameId]
      if type(segm) == list:
          # polygon -- a single object might consist of multiple parts
          # we merge all parts into one mask rle code
          rles = maskUtils.frPyObjects(segm, h, w)
          rle = maskUtils.merge(rles)
      elif type(segm["counts"]) == list:
          # uncompressed RLE
          rle = maskUtils.frPyObjects(segm, h, w)
      else:
          # rle
          rle = segm
      return rle
  
imports: import copy
  import itertools
  import json
  import sys
  import time
  from collections import defaultdict
  import numpy
  from pycocotools import mask
label_desc: Use image node_id 10 for calling the YTVIS obj's underlying member method code with example usage: obj.annToRLE(ann, frameId) and returns: rle