class_docstr: Run length encoding of a mask.
  
  Don't instantiate this class directly, instead use the classmethods
  `from_coco` and `from_kaggle`.
docstr: Described [here](https://www.kaggle.com/c/imaterialist-fashion-2020-fgvc7/overview/evaluation)
docstr_tok: ["Described","[","here","]","(","https",":","\/\/www.kaggle.com\/c\/imaterialist-fashion-2020-fgvc7\/overview\/evaluation",")"]
code: def from_kaggle(cls, counts: Sequence[int]):
      """Described [here](https://www.kaggle.com/c/imaterialist-fashion-2020-fgvc7/overview/evaluation)"""
      if len(counts) % 2 != 0:
          raise ValueError("Counts must be divisible by 2")
  
      current = 1
      coco_counts = []
      for start, count in zip(counts[::2], counts[1::2]):
          coco_counts.append(start - current)  # zeros
          coco_counts.append(count)  # ones
          current = start + count
  
      # remove trailing zero
      if coco_counts[-1] == 0:
          coco_counts.pop(-1)
  
      return cls.from_coco(coco_counts)
  
imports: from icevision.imports import *
  from icevision.utils import *
  from PIL import Image
label_desc: Use image node_id 6 for calling the RLE obj's underlying member method code with example usage: obj.from_kaggle(cls, counts) and returns: cls