parameters: (self, ann)
return_statement: return rle
docstring: Convert annotation which can be polygons, uncompressed RLE to RLE.
          :return: binary mask (numpy 2D array)
docstring_summary: Convert annotation which can be polygons, uncompressed RLE to RLE.
          :return: binary mask (numpy 2D array)
docstring_tokens: Convert annotation which can be polygons uncompressed RLE to RLE . : return : binary mask ( numpy 2D array )
function: def annToRLE(self, ann):
          """
          Convert annotation which can be polygons, uncompressed RLE to RLE.
          :return: binary mask (numpy 2D array)
          """
          t = self.imgs[ann['image_id']]
          h, w = t['height'], t['width']
          segm = ann['segmentation']
          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 = ann['segmentation']
          return rle
function_tokens: def annToRLE ( self , ann ) : t = self . imgs [ ann [ 'image_id' ] ] h , w = t [ 'height' ] , t [ 'width' ] segm = ann [ 'segmentation' ] 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 = ann [ 'segmentation' ] return rle