You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/03/30 10:21:46 UTC

[GitHub] [beam] mwalenia opened a new pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

mwalenia opened a new pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261
 
 
   This PR adds a VideoIntelligence transform to Java SDK, analogous to Python transforms introduced
   in #10764.
   
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   Post-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
   Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/)
   Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/) | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python2_PVR_Flink_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/)
   XLang | --- | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/)
   
   Pre-Commit Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   
   --- |Java | Python | Go | Website
   --- | --- | --- | --- | ---
   Non-portable | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/)<br>[![Build Status](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/) 
   Portable | --- | [![Build Status](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | ---
   
   See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia merged pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia merged pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-610373175
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-605915499
 
 
   R: @Ardagan 
   CC: @kamilwu 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-608379007
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-610124063
 
 
   Run Python Precommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#discussion_r402921841
 
 

 ##########
 File path: sdks/java/extensions/ml/src/test/java/org/apache/beam/sdk/extensions/ml/VideoIntelligenceIT.java
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * 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 static org.apache.beam.sdk.extensions.ml.VideoIntelligence.annotateFromURI;
+import static org.junit.Assert.assertEquals;
+
+import com.google.cloud.videointelligence.v1.Feature;
+import com.google.cloud.videointelligence.v1.VideoAnnotationResults;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.SerializableFunction;
+import org.apache.beam.sdk.values.PCollection;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class VideoIntelligenceIT {
+  @Rule public TestPipeline testPipeline = TestPipeline.create();
+  private static final String VIDEO_URI =
+      "gs://apache-beam-samples/advanced_analytics/video/gbikes_dinosaur.mp4";
+  private List<Feature> featureList = Collections.singletonList(Feature.LABEL_DETECTION);
+
+  @Test
+  public void annotateVideoFromURINoContext() {
+    PCollection<List<VideoAnnotationResults>> annotationResults =
+        testPipeline
+            .apply(Create.of(VIDEO_URI))
+            .apply("Annotate video", ParDo.of(annotateFromURI(featureList, null)));
+    PAssert.that(annotationResults).satisfies(new VerifyVideoAnnotationResult());
+    testPipeline.run().waitUntilFinish();
+  }
+
+  private static class VerifyVideoAnnotationResult
+      implements SerializableFunction<Iterable<List<VideoAnnotationResults>>, Void> {
+
+    @Override
+    public Void apply(Iterable<List<VideoAnnotationResults>> input) {
+      List<Boolean> labelEvaluations = new ArrayList<>();
+      input.forEach(
 
 Review comment:
   Ok, done. What do you think?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-610968169
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-608368553
 
 
   > I'm a bit confused which binary will these classes be added to. Do we need update of release process?
   
   I'm not sure how I can check this, do you have any pointers?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-608384804
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] jkff commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
jkff commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-615463060
 
 
   Hi! Drive-by comment: in the current form this transform violates https://beam.apache.org/contribute/ptransform-style-guide/#exposing-a-ptransform-vs-something-else , specifically, it exposes a set of DoFn's rather than exposing a set of PTransforms. There are several very compelling advantages to exposing PTransform's, mainly, compatibility: once it's a DoFn, you can never add anything else into it (e.g. a reshuffle) without breaking client code - but you can change the internal implementation of a PTransform at will. Many PTransforms that used to be DoFn's before that style guide was created, eventually evolved to be more complex.
   
   Could you consider restructuring it in a follow-up PR? A similar DoFn-like PTransform you can take example from is https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Regex.java.
   
   Thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-610173883
 
 
   Community metrics should be irrelevvant failure.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-605979593
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan removed a comment on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan removed a comment on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-613550796
 
 
   run python precommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-607055702
 
 
   @Ardagan can you take a look at this or delegate to somebody else? Thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#discussion_r402921893
 
 

 ##########
 File path: settings.gradle
 ##########
 @@ -165,3 +165,6 @@ include "beam-test-infra-metrics"
 project(":beam-test-infra-metrics").dir = file(".test-infra/metrics")
 include "beam-test-tools"
 project(":beam-test-tools").dir = file(".test-infra/tools")
+include 'sdks:java:extensions:ml'
 
 Review comment:
   Sure, fixed

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-608384753
 
 
   Run Python PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-613550796
 
 
   run python precommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
mwalenia commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-605982124
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-610171762
 
 
   Run CommunityMetrics PreCommit

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#discussion_r402606094
 
 

 ##########
 File path: settings.gradle
 ##########
 @@ -165,3 +165,6 @@ include "beam-test-infra-metrics"
 project(":beam-test-infra-metrics").dir = file(".test-infra/metrics")
 include "beam-test-tools"
 project(":beam-test-tools").dir = file(".test-infra/tools")
+include 'sdks:java:extensions:ml'
 
 Review comment:
   move this up to the rest of extensions.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] jkff edited a comment on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
jkff edited a comment on issue #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#issuecomment-615463060
 
 
   Hi!
   
   Drive-by comment: in the current form this transform violates the [PTransform Style Guide](https://beam.apache.org/contribute/ptransform-style-guide/#exposing-a-ptransform-vs-something-else), specifically, it exposes a set of `DoFn`s rather than exposing a set of `PTransform`s.
   
   There are several very compelling advantages to exposing `PTransform`s, mainly, compatibility: once it's a `DoFn` and clients use it via `ParDo`, you can never add anything else into it (e.g. a reshuffle) without breaking client code - but you can change the internal implementation of a `PTransform` at will. Many `PTransform`s that used to be `DoFn`s before that style guide was created, eventually evolved to be more complex.
   
   Could you consider restructuring it in a follow-up PR? A similar DoFn-like PTransform you can take example from is [Regex](https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Regex.java).
   
   Thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [beam] Ardagan commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK

Posted by GitBox <gi...@apache.org>.
Ardagan commented on a change in pull request #11261: [BEAM-9147] Add a VideoIntelligence transform to Java SDK
URL: https://github.com/apache/beam/pull/11261#discussion_r402605081
 
 

 ##########
 File path: sdks/java/extensions/ml/src/test/java/org/apache/beam/sdk/extensions/ml/VideoIntelligenceIT.java
 ##########
 @@ -0,0 +1,79 @@
+/*
+ * 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 static org.apache.beam.sdk.extensions.ml.VideoIntelligence.annotateFromURI;
+import static org.junit.Assert.assertEquals;
+
+import com.google.cloud.videointelligence.v1.Feature;
+import com.google.cloud.videointelligence.v1.VideoAnnotationResults;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.SerializableFunction;
+import org.apache.beam.sdk.values.PCollection;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class VideoIntelligenceIT {
+  @Rule public TestPipeline testPipeline = TestPipeline.create();
+  private static final String VIDEO_URI =
+      "gs://apache-beam-samples/advanced_analytics/video/gbikes_dinosaur.mp4";
+  private List<Feature> featureList = Collections.singletonList(Feature.LABEL_DETECTION);
+
+  @Test
+  public void annotateVideoFromURINoContext() {
+    PCollection<List<VideoAnnotationResults>> annotationResults =
+        testPipeline
+            .apply(Create.of(VIDEO_URI))
+            .apply("Annotate video", ParDo.of(annotateFromURI(featureList, null)));
+    PAssert.that(annotationResults).satisfies(new VerifyVideoAnnotationResult());
+    testPipeline.run().waitUntilFinish();
+  }
+
+  private static class VerifyVideoAnnotationResult
+      implements SerializableFunction<Iterable<List<VideoAnnotationResults>>, Void> {
+
+    @Override
+    public Void apply(Iterable<List<VideoAnnotationResults>> input) {
+      List<Boolean> labelEvaluations = new ArrayList<>();
+      input.forEach(
 
 Review comment:
   This part is really hard to read. Would be good to add named methods or use similar approach.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services