Skip to content

Commit 37e74e9

Browse files
authored
Add video v1p1beta samples for face detection and video transcription (#1070)
* Add video v1p1beta samples for face detection and video transcription * Update based on Feedback * Clean up READMEs * Add timeout for tests
1 parent 8a48f92 commit 37e74e9

File tree

9 files changed

+588
-114
lines changed

9 files changed

+588
-114
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
<module>translate/cloud-client</module>
9393

9494
<module>unittests</module>
95+
<module>video/beta</module>
9596
<module>video/cloud-client</module>
9697
<module>vision/beta/cloud-client</module>
9798
<module>vision/cloud-client</module>

video/beta/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Video Feature Detection Sample
2+
3+
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=video/cloud-client/README.md">
4+
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>
5+
6+
[Google Cloud Video Intelligence API][video] provides feature detection for
7+
videos. This API is part of the larger collection of Cloud Machine Learning
8+
APIs.
9+
10+
This sample Java application demonstrates how to access the Cloud Video API
11+
using the [Google Cloud Client Library for Java][google-cloud-java].
12+
13+
[video]: https://cloud.google.com/video-intelligence/docs/
14+
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java
15+
16+
## Build the sample
17+
18+
Install [Maven](http://maven.apache.org/).
19+
20+
Build your project with:
21+
22+
```
23+
mvn clean package -DskipTests
24+
```
25+
26+
### Analyze a video
27+
Please follow the [Set Up Your Project](https://cloud.google.com/video-intelligence/docs/getting-started#set_up_your_project)
28+
steps in the Quickstart doc to create a project and enable the Google Cloud
29+
Video Intelligence API. Following those steps, make sure that you
30+
[Set Up a Service Account](https://cloud.google.com/video-intelligence/docs/common/auth#set_up_a_service_account),
31+
and export the following environment variable:
32+
33+
```
34+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
35+
```
36+
37+
After you have authorized, you can analyze videos.
38+
39+
Detect Faces' Bounding Boxes
40+
```
41+
mvn exec:java -DDetect -Dexec.args="faces-bounding-boxes gs://YOUR_BUCKET/YOUR_VIDEO.mp4"
42+
```
43+
44+
Detect Faces' Emotions
45+
```
46+
mvn exec:java -DDetect -Dexec.args="faces-emotions gs://YOUR_BUCKET/YOUR_VIDEO.mp4"
47+
```
48+
49+
Video Transcription
50+
```
51+
mvn exec:java -DDetect -Dexec.args="speech-transcription gs://YOUR_BUCKET/YOUR_VIDEO.mp4"
52+
```

video/beta/pom.xml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<!--
2+
Copyright 2018 Google Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<project>
17+
<modelVersion>4.0.0</modelVersion>
18+
<groupId>com.example.video</groupId>
19+
<artifactId>video-google-cloud-samples-beta</artifactId>
20+
<packaging>jar</packaging>
21+
22+
<!--
23+
The parent pom defines common style checks and testing strategies for our samples.
24+
Removing or replacing it should not affect the execution of the samples in anyway.
25+
-->
26+
<parent>
27+
<groupId>com.google.cloud.samples</groupId>
28+
<artifactId>shared-configuration</artifactId>
29+
<version>1.0.8</version>
30+
</parent>
31+
32+
<properties>
33+
<maven.compiler.target>1.8</maven.compiler.target>
34+
<maven.compiler.source>1.8</maven.compiler.source>
35+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36+
</properties>
37+
38+
<dependencies>
39+
<!-- [START dependencies] -->
40+
<dependency>
41+
<groupId>com.google.cloud</groupId>
42+
<artifactId>google-cloud-video-intelligence</artifactId>
43+
<version>0.41.0-beta</version>
44+
</dependency>
45+
<!-- [END dependencies] -->
46+
47+
<!-- Test dependencies -->
48+
<dependency>
49+
<groupId>junit</groupId>
50+
<artifactId>junit</artifactId>
51+
<version>4.12</version>
52+
<scope>test</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>com.google.truth</groupId>
56+
<artifactId>truth</artifactId>
57+
<version>0.39</version>
58+
<scope>test</scope>
59+
</dependency>
60+
</dependencies>
61+
<build>
62+
<plugins>
63+
<plugin>
64+
<artifactId>maven-assembly-plugin</artifactId>
65+
<configuration>
66+
<archive>
67+
<manifest>
68+
<mainClass>com.example.video.Detect</mainClass>
69+
</manifest>
70+
</archive>
71+
<descriptorRefs>
72+
<descriptorRef>jar-with-dependencies</descriptorRef>
73+
</descriptorRefs>
74+
</configuration>
75+
</plugin>
76+
</plugins>
77+
</build>
78+
<profiles>
79+
<profile>
80+
<id>Detect</id>
81+
<activation>
82+
<property>
83+
<name>Detect</name>
84+
</property>
85+
</activation>
86+
<build>
87+
<plugins>
88+
<plugin>
89+
<groupId>org.codehaus.mojo</groupId>
90+
<artifactId>exec-maven-plugin</artifactId>
91+
<version>1.6.0</version>
92+
<executions>
93+
<execution>
94+
<goals>
95+
<goal>java</goal>
96+
</goals>
97+
</execution>
98+
</executions>
99+
<configuration>
100+
<mainClass>com.example.video.Detect</mainClass>
101+
<cleanupDaemonThreads>false</cleanupDaemonThreads>
102+
</configuration>
103+
</plugin>
104+
</plugins>
105+
</build>
106+
</profile>
107+
</profiles>
108+
</project>

0 commit comments

Comments
 (0)