docstr: Init Mask from coco segmentation representation.
  
  Args:
      segmentation : List[List]
          [
              [x1, y1, x2, y2, x3, y3, ...],
              [x1, y1, x2, y2, x3, y3, ...],
              ...
          ]
      full_shape: List
          Size of the full image, should be in the form of [height, width]
      shift_amount: List
          To shift the box and mask predictions from sliced image to full
          sized image, should be in the form of [shift_x, shift_y]
docstr_tok: ["Init","Mask","from","coco","segmentation","representation",".","Args",":","segmentation",":","List","[","List","]","[","[","x1",",","y1",",","x2",",","y2",",","x3",",","y3",",","...","]",",","[","x1",",","y1",",","x2",",","y2",",","x3",",","y3",",","...","]",",","...","]","full_shape",":","List","Size","of","the","full","image",",","should","be","in","the","form","of","[","height",",","width","]","shift_amount",":","List","To","shift","the","box","and","mask","predictions","from","sliced","image","to","full","sized","image",",","should","be","in","the","form","of","[","shift_x",",","shift_y","]"]
code: def from_coco_segmentation(
      cls,
      segmentation,
      full_shape=None,
      shift_amount: list = [0, 0],
  ):
      """
      Init Mask from coco segmentation representation.
  
      Args:
          segmentation : List[List]
              [
                  [x1, y1, x2, y2, x3, y3, ...],
                  [x1, y1, x2, y2, x3, y3, ...],
                  ...
              ]
          full_shape: List
              Size of the full image, should be in the form of [height, width]
          shift_amount: List
              To shift the box and mask predictions from sliced image to full
              sized image, should be in the form of [shift_x, shift_y]
      """
      # confirm full_shape is given
      if full_shape is None:
          raise ValueError("full_shape must be provided")
      bool_mask = get_bool_mask_from_coco_segmentation(
          segmentation, height=full_shape[0], width=full_shape[1]
      )
      return cls(
          bool_mask=bool_mask,
          shift_amount=shift_amount,
          full_shape=full_shape,
      )
  
imports: import copy
  from typing import Dict, List, Optional
  import numpy
  from sahi.utils.coco import CocoAnnotation, CocoPrediction
  from sahi.utils.cv import get_bbox_from_bool_mask, get_bool_mask_from_coco_segmentation, get_coco_segmentation_from_bool_mask
  from sahi.utils.shapely import ShapelyAnnotation
label_desc: Use image node_id 2 for calling the Mask obj's underlying member method code with example usage: obj.from_coco_segmentation(cls, segmentation, full_shape, shift_amount) and returns: cls