class_docstr: Class that performs image segmentation on images.
  
  The API expects a TFLite model with mandatory TFLite Model Metadata.
  
  Input tensor:
    (kTfLiteUInt8/kTfLiteFloat32)
    - image input of size `[batch x height x width x channels]`.
    - batch inference is not supported (`batch` is required to be 1).
    - RGB and greyscale inputs are supported (`channels` is required to be
      1 or 3).
    - if type is kTfLiteFloat32, NormalizationOptions are required to be
      attached to the metadata for input normalization.
  Output tensors:
    (kTfLiteUInt8/kTfLiteFloat32)
    - list of segmented masks.
    - if `output_category_mask` is True, uint8 Image, Image vector of size 1.
    - if `output_confidence_masks` is True, float32 Image list of size
      `channels`.
    - batch is always 1
  
  An example of such model can be found at:
  https://tfhub.dev/tensorflow/lite-model/deeplabv3/1/metadata/2
class_docstr_tok: ["Class","that","performs","image","segmentation","on","images",".","The","API","expects","a","TFLite","model","with","mandatory","TFLite","Model","Metadata",".","Input","tensor",":","(","kTfLiteUInt8\/kTfLiteFloat32",")","-","image","input","of","size","`","[","batch","x","height","x","width","x","channels","]","`",".","-","batch","inference","is","not","supported","(","`","batch","`","is","required","to","be","1",")",".","-","RGB","and","greyscale","inputs","are","supported","(","`","channels","`","is","required","to","be","1","or","3",")",".","-","if","type","is","kTfLiteFloat32",",","NormalizationOptions","are","required","to","be","attached","to","the","metadata","for","input","normalization",".","Output","tensors",":","(","kTfLiteUInt8\/kTfLiteFloat32",")","-","list","of","segmented","masks",".","-","if","`","output_category_mask","`","is","True",",","uint8","Image",",","Image","vector","of","size","1",".","-","if","`","output_confidence_masks","`","is","True",",","float32","Image","list","of","size","`","channels","`",".","-","batch","is","always","1","An","example","of","such","model","can","be","found","at",":","https",":","\/\/tfhub.dev\/tensorflow\/lite-model\/deeplabv3\/1\/metadata\/2"]
docstr: Performs segmentation on the provided video frames.
  
  Only use this method when the ImageSegmenter is created with the video
  running mode. It's required to provide the video frame's timestamp (in
  milliseconds) along with the video frame. The input timestamps should be
  monotonically increasing for adjacent calls of this method.
  
  Args:
    image: MediaPipe Image.
    timestamp_ms: The timestamp of the input video frame in milliseconds.
    image_processing_options: Options for image processing.
  
  Returns:
    If the output_type is CATEGORY_MASK, the returned vector of images is
    per-category segmented image mask.
    If the output_type is CONFIDENCE_MASK, the returned vector of images
    contains only one confidence image mask. A segmentation result object that
    contains a list of segmentation masks as images.
  
  Raises:
    ValueError: If any of the input arguments is invalid.
    RuntimeError: If image segmentation failed to run.
docstr_tok: ["Performs","segmentation","on","the","provided","video","frames",".","Only","use","this","method","when","the","ImageSegmenter","is","created","with","the","video","running","mode",".","It","'s","required","to","provide","the","video","frame","'s","timestamp","(","in","milliseconds",")","along","with","the","video","frame",".","The","input","timestamps","should","be","monotonically","increasing","for","adjacent","calls","of","this","method",".","Args",":","image",":","MediaPipe","Image",".","timestamp_ms",":","The","timestamp","of","the","input","video","frame","in","milliseconds",".","image_processing_options",":","Options","for","image","processing",".","Returns",":","If","the","output_type","is","CATEGORY_MASK",",","the","returned","vector","of","images","is","per-category","segmented","image","mask",".","If","the","output_type","is","CONFIDENCE_MASK",",","the","returned","vector","of","images","contains","only","one","confidence","image","mask",".","A","segmentation","result","object","that","contains","a","list","of","segmentation","masks","as","images",".","Raises",":","ValueError",":","If","any","of","the","input","arguments","is","invalid",".","RuntimeError",":","If","image","segmentation","failed","to","run","."]
code: def segment_for_video(
      self,
      image: image_module.Image,
      timestamp_ms: int,
      image_processing_options: Optional[
          _ImageProcessingOptions
      ] = None,
  ) -> ImageSegmenterResult:
      """Performs segmentation on the provided video frames.
  
      Only use this method when the ImageSegmenter is created with the video
      running mode. It's required to provide the video frame's timestamp (in
      milliseconds) along with the video frame. The input timestamps should be
      monotonically increasing for adjacent calls of this method.
  
      Args:
        image: MediaPipe Image.
        timestamp_ms: The timestamp of the input video frame in milliseconds.
        image_processing_options: Options for image processing.
  
      Returns:
        If the output_type is CATEGORY_MASK, the returned vector of images is
        per-category segmented image mask.
        If the output_type is CONFIDENCE_MASK, the returned vector of images
        contains only one confidence image mask. A segmentation result object that
        contains a list of segmentation masks as images.
  
      Raises:
        ValueError: If any of the input arguments is invalid.
        RuntimeError: If image segmentation failed to run.
      """
      normalized_rect = self.convert_to_normalized_rect(
          image_processing_options, image, roi_allowed=False
      )
      output_packets = self._process_video_data(
          {
              _IMAGE_IN_STREAM_NAME: packet_creator.create_image(
                  image
              ).at(timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND),
              _NORM_RECT_STREAM_NAME: packet_creator.create_proto(
                  normalized_rect.to_pb2()
              ).at(timestamp_ms * _MICRO_SECONDS_PER_MILLISECOND),
          }
      )
      segmentation_result = ImageSegmenterResult()
  
      if _CONFIDENCE_MASKS_STREAM_NAME in output_packets:
          segmentation_result.confidence_masks = (
              packet_getter.get_image_list(
                  output_packets[_CONFIDENCE_MASKS_STREAM_NAME]
              )
          )
  
      if _CATEGORY_MASK_STREAM_NAME in output_packets:
          segmentation_result.category_mask = packet_getter.get_image(
              output_packets[_CATEGORY_MASK_STREAM_NAME]
          )
  
      return segmentation_result
  
imports: import dataclasses
  from typing import Callable, List, Mapping, Optional
  from mediapipe.python import packet_creator
  from mediapipe.python import packet_getter
  from mediapipe.python._framework_bindings import image
  from mediapipe.python._framework_bindings import packet
  from mediapipe.tasks.cc.vision.image_segmenter.calculators import tensors_to_segmentation_calculator_pb2
  from mediapipe.tasks.cc.vision.image_segmenter.proto import image_segmenter_graph_options_pb2
  from mediapipe.tasks.cc.vision.image_segmenter.proto import segmenter_options_pb2
  from mediapipe.tasks.python.components.containers import rect
  from mediapipe.tasks.python.core import base_options
  from mediapipe.tasks.python.core import task_info
  from mediapipe.tasks.python.core.optional_dependencies import doc_controls
  from mediapipe.tasks.python.vision.core import base_vision_task_api
  from mediapipe.tasks.python.vision.core import image_processing_options
  from mediapipe.tasks.python.vision.core import vision_task_running_mode
label_desc: Use image node_id 6 for calling the ImageSegmenter obj's underlying member method code with example usage: obj.segment_for_video(image, timestamp_ms, image_processing_options) and returns: segmentation_result