apache_beam.ml.gcp.videointelligenceml module¶
A connector for sending API requests to the GCP Video Intelligence API.
-
class
apache_beam.ml.gcp.videointelligenceml.
AnnotateVideo
(features, location_id=None, metadata=None, timeout=120, context_side_input=None)[source]¶ Bases:
apache_beam.transforms.ptransform.PTransform
A
PTransform
for annotating video using the GCP Video Intelligence API ref: https://cloud.google.com/video-intelligence/docsSends each element to the GCP Video Intelligence API. Element is a Union[text_type, binary_type] of either an URI (e.g. a GCS URI) or binary_type base64-encoded video data. Accepts an AsDict side input that maps each video to a video context.
Parameters: - features – (List[
videointelligence_v1.enums.Feature
]) Required. The Video Intelligence API features to detect - location_id – (str) Optional. Cloud region where annotation should take place. If no region is specified, a region will be determined based on video file location.
- metadata – (Sequence[Tuple[str, str]]) Optional. Additional metadata that is provided to the method.
- timeout – (int) Optional. The time in seconds to wait for the response from the Video Intelligence API
- context_side_input –
(beam.pvalue.AsDict) Optional. An
AsDict
of a PCollection to be passed to the _VideoAnnotateFn as the video context mapping containing additional video context and/or feature-specific parameters. Example usage:video_contexts = [('gs://cloud-samples-data/video/cat.mp4', Union[dict, ``videointelligence_v1.types.VideoContext``]), ('gs://some-other-video/sample.mp4', Union[dict, ``videointelligence_v1.types.VideoContext``]),] context_side_input = ( p | "Video contexts" >> beam.Create(video_contexts) ) videointelligenceml.AnnotateVideo(features, context_side_input=beam.pvalue.AsDict(context_side_input)))
- features – (List[
-
class
apache_beam.ml.gcp.videointelligenceml.
AnnotateVideoWithContext
(features, location_id=None, metadata=None, timeout=120)[source]¶ Bases:
apache_beam.ml.gcp.videointelligenceml.AnnotateVideo
A
PTransform
for annotating video using the GCP Video Intelligence API ref: https://cloud.google.com/video-intelligence/docsSends each element to the GCP Video Intelligence API. Element is a tuple of
(Union[text_type, binary_type], Optional[videointelligence.types.VideoContext])where the former is either an URI (e.g. a GCS URI) or binary_type base64-encoded video data
Parameters: - features – (List[
videointelligence_v1.enums.Feature
]) Required. the Video Intelligence API features to detect - location_id – (str) Optional. Cloud region where annotation should take place. If no region is specified, a region will be determined based on video file location.
- metadata – (Sequence[Tuple[str, str]]) Optional. Additional metadata that is provided to the method.
- timeout – (int) Optional. The time in seconds to wait for the response from the Video Intelligence API
- features – (List[