class_docstr: Creates ShapelyAnnotation (as shapely MultiPolygon).
  Can convert this instance annotation to various formats.
docstr: [
      [x1, y1, x2, y2, x3, y3, ...],
      [x1, y1, x2, y2, x3, y3, ...],
      ...
  ]
docstr_tok: ["[","[","x1",",","y1",",","x2",",","y2",",","x3",",","y3",",","...","]",",","[","x1",",","y1",",","x2",",","y2",",","x3",",","y3",",","...","]",",","...","]"]
code: def to_coco_segmentation(self):
      """
      [
          [x1, y1, x2, y2, x3, y3, ...],
          [x1, y1, x2, y2, x3, y3, ...],
          ...
      ]
      """
      coco_segmentation: List = []
      for shapely_polygon in self.multipolygon.geoms:
          # create list_of_points for selected shapely_polygon
          if shapely_polygon.area != 0:
              x_coords = shapely_polygon.exterior.coords.xy[0]
              y_coords = shapely_polygon.exterior.coords.xy[1]
              # fix coord by slice_bbox
              if self.slice_bbox:
                  minx = self.slice_bbox[0]
                  miny = self.slice_bbox[1]
                  x_coords = [x_coord - minx for x_coord in x_coords]
                  y_coords = [y_coord - miny for y_coord in y_coords]
              # convert intersection to coco style segmentation annotation
              coco_polygon = [None] * len(x_coords) * 2
              coco_polygon[0::2] = [int(coord) for coord in x_coords]
              coco_polygon[1::2] = [int(coord) for coord in y_coords]
          else:
              coco_polygon = []
          # remove if first and last points are duplicate
          if coco_polygon[:2] == coco_polygon[-2:]:
              del coco_polygon[-2:]
          # append coco_polygon to coco_segmentation
          coco_polygon = (
              [point for point in coco_polygon]
              if coco_polygon
              else coco_polygon
          )
          coco_segmentation.append(coco_polygon)
      return coco_segmentation
  
imports: from typing import List
  from shapely.geometry import CAP_STYLE, JOIN_STYLE, MultiPolygon, Polygon, box
label_desc: Use image node_id 8 for calling the ShapelyAnnotation obj's underlying member method code with example usage: obj.to_coco_segmentation() and returns: coco_segmentation