Class VideoIntelligence

java.lang.Object
org.apache.beam.sdk.extensions.ml.VideoIntelligence

public class VideoIntelligence extends Object
Factory class for PTransforms integrating with Google Cloud AI - VideoIntelligence service. Converts GCS URIs of videos or ByteStrings with video contents into Lists of VideoAnnotationResults.

Adding a side input of Maps of elements to VideoContext objects is allowed, so is using KVs of element and VideoContext as input.

Service account with proper permissions is required to use these transforms.

  • Constructor Details

    • VideoIntelligence

      public VideoIntelligence()
  • Method Details

    • annotateFromURI

      public static VideoIntelligence.AnnotateVideoFromUri annotateFromURI(List<com.google.cloud.videointelligence.v1.Feature> featureList, PCollectionView<Map<String,com.google.cloud.videointelligence.v1.VideoContext>> contextSideInput)
      Annotates videos from GCS URIs.
      Parameters:
      featureList - List of features to be annotated
      contextSideInput - Optional side input with map of contexts to URIs
      Returns:
      PTransform performing the necessary operations
    • annotateFromBytes

      public static VideoIntelligence.AnnotateVideoFromBytes annotateFromBytes(PCollectionView<Map<ByteString,com.google.cloud.videointelligence.v1.VideoContext>> contextSideInput, List<com.google.cloud.videointelligence.v1.Feature> featureList)
      Annotates videos from ByteStrings of their contents.
      Parameters:
      contextSideInput - Optional side input with map of contexts to ByteStrings
      featureList - List of features to be annotated
      Returns:
      PTransform performing the necessary operations
    • annotateFromUriWithContext

      public static VideoIntelligence.AnnotateVideoFromURIWithContext annotateFromUriWithContext(List<com.google.cloud.videointelligence.v1.Feature> featureList)
      Annotates videos from key-value pairs of GCS URI and VideoContext.
      Parameters:
      featureList - List of features to be annotated
      Returns:
      PTransform performing the necessary operations
    • annotateFromBytesWithContext

      public static VideoIntelligence.AnnotateVideoFromBytesWithContext annotateFromBytesWithContext(List<com.google.cloud.videointelligence.v1.Feature> featureList)
      Annotates videos from key-value pairs of ByteStrings and VideoContext.
      Parameters:
      featureList - List of features to be annotated
      Returns:
      PTransform performing the necessary operations