code: def convert_coco_poly_to_mask(
      segmentations, height: int, width: int
  ) -> np.ndarray:
      """
      Convert a COCO polygon annotation to a mask.
  
      Args:
          segmentations (`List[List[float]]`):
              List of polygons, each polygon represented by a list of x-y coordinates.
          height (`int`):
              Height of the mask.
          width (`int`):
              Width of the mask.
      """
      try:
          from pycocotools import mask as coco_mask
      except ImportError:
          raise ImportError(
              "Pycocotools is not installed in your environment."
          )
  
      masks = []
      for polygons in segmentations:
          rles = coco_mask.frPyObjects(polygons, height, width)
          mask = coco_mask.decode(rles)
          if len(mask.shape) < 3:
              mask = mask[..., None]
          mask = np.asarray(mask, dtype=np.uint8)
          mask = np.any(mask, axis=2)
          masks.append(mask)
      if masks:
          masks = np.stack(masks, axis=0)
      else:
          masks = np.zeros((0, height, width), dtype=np.uint8)
  
      return masks
  
imports: import pathlib
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  from ...feature_extraction_utils import BatchFeature
  from ...image_processing_utils import BaseImageProcessor, get_size_dict
  from ...image_transforms import PaddingMode, center_to_corners_format, corners_to_center_format, pad, rescale, resize, rgb_to_id, to_channel_dimension_format
  from ...image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, AnnotationFormat, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_batched, is_scaled_image, to_numpy_array, valid_images, validate_annotations
  from ...utils import is_flax_available, is_jax_tensor, is_tf_available, is_tf_tensor, is_torch_available, is_torch_tensor, is_torchvision_available, is_vision_available, logging
  from ...utils.generic import TensorType
label_desc: Use image node_id 9 for calling a global function with example usage: convert_coco_poly_to_mask(segmentations, height, width) and returns: masks