[
https://issues.apache.org/jira/browse/BEAM-9147?focusedWorklogId=425684&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-425684
]
ASF GitHub Bot logged work on BEAM-9147:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Apr/20 12:45
Start Date: 21/Apr/20 12:45
Worklog Time Spent: 10m
Work Description: mwalenia commented on a change in pull request #11464:
URL: https://github.com/apache/beam/pull/11464#discussion_r412151907
##########
File path:
sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/AnnotateVideoFn.java
##########
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.extensions.ml;
+
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.cloud.videointelligence.v1.AnnotateVideoProgress;
+import com.google.cloud.videointelligence.v1.AnnotateVideoRequest;
+import com.google.cloud.videointelligence.v1.AnnotateVideoResponse;
+import com.google.cloud.videointelligence.v1.Feature;
+import com.google.cloud.videointelligence.v1.VideoAnnotationResults;
+import com.google.cloud.videointelligence.v1.VideoContext;
+import com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClient;
+import com.google.protobuf.ByteString;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.values.PCollectionView;
+
+/**
+ * Base class for DoFns used in VideoIntelligence transforms.
+ *
+ * @param <T> Class of input data being passed in - either ByteString - video
data encoded into.
+ * String or String - a GCS URI of the video to be annotated.
+ */
+@Experimental
+abstract class AnnotateVideoFn<T> extends DoFn<T,
List<VideoAnnotationResults>> {
+
+ protected final PCollectionView<Map<T, VideoContext>> contextSideInput;
+ protected final List<Feature> featureList;
+ VideoIntelligenceServiceClient videoIntelligenceServiceClient;
+
+ public AnnotateVideoFn(
+ PCollectionView<Map<T, VideoContext>> contextSideInput, List<Feature>
featureList) {
+ this.contextSideInput = contextSideInput;
+ this.featureList = featureList;
+ }
+
+ public AnnotateVideoFn(List<Feature> featureList) {
+ contextSideInput = null;
+ this.featureList = featureList;
+ }
+
+ @StartBundle
Review comment:
Moved, thanks for the tip
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 425684)
Time Spent: 5h 50m (was: 5h 40m)
> [Java] PTransform that integrates Video Intelligence functionality
> ------------------------------------------------------------------
>
> Key: BEAM-9147
> URL: https://issues.apache.org/jira/browse/BEAM-9147
> Project: Beam
> Issue Type: Sub-task
> Components: io-java-gcp
> Reporter: Kamil Wasilewski
> Assignee: MichaĆ Walenia
> Priority: Major
> Fix For: 2.21.0
>
> Time Spent: 5h 50m
> Remaining Estimate: 0h
>
> The goal is to create a PTransform that integrates Google Cloud Video
> Intelligence functionality [1].
> The transform should be able to take both video GCS location or video data
> bytes as an input.
> A module with the transform should be put into _`sdks/java/extensions`_
> folder.
> [1] [https://cloud.google.com/video-intelligence/]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)