Skip to content

Commit 18d92f8

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add support for video object tracking (via synth). (googleapis#8278)
1 parent e65044c commit 18d92f8

72 files changed

Lines changed: 2351 additions & 1089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

automl/.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Generated by synthtool. DO NOT EDIT!
12
[run]
23
branch = True
34

automl/.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Generated by synthtool. DO NOT EDIT!
12
[flake8]
23
ignore = E203, E266, E501, W503
34
exclude =

automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from google.cloud.automl_v1beta1.gapic import auto_ml_client_config
3737
from google.cloud.automl_v1beta1.gapic import enums
3838
from google.cloud.automl_v1beta1.gapic.transports import auto_ml_grpc_transport
39+
from google.cloud.automl_v1beta1.proto import annotation_spec_pb2
3940
from google.cloud.automl_v1beta1.proto import column_spec_pb2
4041
from google.cloud.automl_v1beta1.proto import dataset_pb2
4142
from google.cloud.automl_v1beta1.proto import image_pb2
@@ -1272,8 +1273,8 @@ def deploy_model(
12721273
same parameters has no effect. Deploying with different parametrs (as
12731274
e.g. changing
12741275
1275-
``node_number`` ) will update the deployment without pausing the model's
1276-
availability.
1276+
``node_number``) will reset the deployment state without pausing the
1277+
model's availability.
12771278
12781279
Only applicable for Text Classification, Image Object Detection and
12791280
Tables; all other domains manage deployment automatically.

automl/google/cloud/automl_v1beta1/gapic/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ClassificationType(enum.IntEnum):
2424
Type of the classification problem.
2525
2626
Attributes:
27-
CLASSIFICATION_TYPE_UNSPECIFIED (int): Should not be used, an un-set enum has this value by default.
27+
CLASSIFICATION_TYPE_UNSPECIFIED (int): An un-set value of this enum.
2828
MULTICLASS (int): At most one label is allowed per example.
2929
MULTILABEL (int): Multiple labels are allowed for one example.
3030
"""

automl/google/cloud/automl_v1beta1/gapic/prediction_service_client.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from google.cloud.automl_v1beta1.gapic.transports import (
3636
prediction_service_grpc_transport,
3737
)
38+
from google.cloud.automl_v1beta1.proto import annotation_spec_pb2
3839
from google.cloud.automl_v1beta1.proto import column_spec_pb2
3940
from google.cloud.automl_v1beta1.proto import data_items_pb2
4041
from google.cloud.automl_v1beta1.proto import dataset_pb2
@@ -218,15 +219,16 @@ def predict(
218219
image\_bytes up to 30MB.
219220
- Image Object Detection - Image in .JPEG, .GIF or .PNG format,
220221
image\_bytes up to 30MB.
221-
- Text Classification - TextSnippet, content up to 10,000 characters,
222+
- Text Classification - TextSnippet, content up to 60,000 characters,
222223
UTF-8 encoded.
223224
- Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8
224-
NFC encoded. \* Translation - TextSnippet, content up to 25,000
225-
characters, UTF-8 encoded.
226-
- Tables - Row, with column values matching the columns of the model,
227-
up to 5MB.
228-
- Text Sentiment - TextSnippet, content up 500 characters, UTF-8
225+
NFC encoded.
226+
- Translation - TextSnippet, content up to 25,000 characters, UTF-8
229227
encoded.
228+
- Tables - Row, with column values matching the columns of the model,
229+
up to 5MB. Not available for FORECASTING
230+
231+
``prediction_type``.
230232
231233
Example:
232234
>>> from google.cloud import automl_v1beta1
@@ -257,12 +259,13 @@ def predict(
257259
makes predictions for an image, it will only produce results that
258260
have at least this confidence score. The default is 0.5.
259261
260-
- For Image Object Detection: ``score_threshold`` - (float) When Model
261-
detects objects on the image, it will only produce bounding boxes
262-
which have at least this confidence score. Value in 0 to 1 range,
263-
default is 0.5. ``max_bounding_box_count`` - (int64) No more than
264-
this number of bounding boxes will be returned in the response.
265-
Default is 100, the requested value may be limited by server.
262+
- For Tables: ``feature_importance`` - (boolean) Whether
263+
264+
[feature\_importance][[google.cloud.automl.v1beta1.TablesModelColumnInfo.feature\_importance]
265+
should be populated in the returned
266+
267+
[TablesAnnotation(-s)][[google.cloud.automl.v1beta1.TablesAnnotation].
268+
The default is false.
266269
retry (Optional[google.api_core.retry.Retry]): A retry object used
267270
to retry requests. If ``None`` is specified, requests will not
268271
be retried.
@@ -332,6 +335,7 @@ def batch_predict(
332335
Available for following ML problems:
333336
334337
- Video Classification
338+
- Video Object Tracking
335339
- Text Extraction
336340
- Tables
337341
@@ -397,6 +401,16 @@ def batch_predict(
397401
classification type, the quality of it depends on training data, but
398402
there are no metrics provided to describe that quality. The default
399403
is "false".
404+
405+
- For Video Object Tracking: ``score_threshold`` - (float) When Model
406+
detects objects on video frames, it will only produce bounding boxes
407+
which have at least this confidence score. Value in 0 to 1 range,
408+
default is 0.5. ``max_bounding_box_count`` - (int64) No more than
409+
this number of bounding boxes will be returned per frame. Default is
410+
100, the requested value may be limited by server.
411+
``min_bounding_box_size`` - (float) Only bounding boxes with shortest
412+
edge at least that long as a relative value of video frame size will
413+
be returned. Value in 0 to 1 range. Default is 0.
400414
retry (Optional[google.api_core.retry.Retry]): A retry object used
401415
to retry requests. If ``None`` is specified, requests will not
402416
be retried.

automl/google/cloud/automl_v1beta1/gapic/transports/auto_ml_grpc_transport.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def __init__(
7575
)
7676

7777
@classmethod
78-
def create_channel(cls, address="automl.googleapis.com:443", credentials=None):
78+
def create_channel(
79+
cls, address="automl.googleapis.com:443", credentials=None, **kwargs
80+
):
7981
"""Create and return a gRPC channel object.
8082
8183
Args:
@@ -85,12 +87,14 @@ def create_channel(cls, address="automl.googleapis.com:443", credentials=None):
8587
credentials identify this application to the service. If
8688
none are specified, the client will attempt to ascertain
8789
the credentials from the environment.
90+
kwargs (dict): Keyword arguments, which are passed to the
91+
channel creation.
8892
8993
Returns:
9094
grpc.Channel: A gRPC channel object.
9195
"""
9296
return google.api_core.grpc_helpers.create_channel(
93-
address, credentials=credentials, scopes=cls._OAUTH_SCOPES
97+
address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
9498
)
9599

96100
@property
@@ -268,8 +272,8 @@ def deploy_model(self):
268272
same parameters has no effect. Deploying with different parametrs (as
269273
e.g. changing
270274
271-
``node_number`` ) will update the deployment without pausing the model's
272-
availability.
275+
``node_number``) will reset the deployment state without pausing the
276+
model's availability.
273277
274278
Only applicable for Text Classification, Image Object Detection and
275279
Tables; all other domains manage deployment automatically.

automl/google/cloud/automl_v1beta1/gapic/transports/prediction_service_grpc_transport.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def __init__(
7979
)
8080

8181
@classmethod
82-
def create_channel(cls, address="automl.googleapis.com:443", credentials=None):
82+
def create_channel(
83+
cls, address="automl.googleapis.com:443", credentials=None, **kwargs
84+
):
8385
"""Create and return a gRPC channel object.
8486
8587
Args:
@@ -89,12 +91,14 @@ def create_channel(cls, address="automl.googleapis.com:443", credentials=None):
8991
credentials identify this application to the service. If
9092
none are specified, the client will attempt to ascertain
9193
the credentials from the environment.
94+
kwargs (dict): Keyword arguments, which are passed to the
95+
channel creation.
9296
9397
Returns:
9498
grpc.Channel: A gRPC channel object.
9599
"""
96100
return google.api_core.grpc_helpers.create_channel(
97-
address, credentials=credentials, scopes=cls._OAUTH_SCOPES
101+
address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
98102
)
99103

100104
@property
@@ -118,15 +122,16 @@ def predict(self):
118122
image\_bytes up to 30MB.
119123
- Image Object Detection - Image in .JPEG, .GIF or .PNG format,
120124
image\_bytes up to 30MB.
121-
- Text Classification - TextSnippet, content up to 10,000 characters,
125+
- Text Classification - TextSnippet, content up to 60,000 characters,
122126
UTF-8 encoded.
123127
- Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8
124-
NFC encoded. \* Translation - TextSnippet, content up to 25,000
125-
characters, UTF-8 encoded.
126-
- Tables - Row, with column values matching the columns of the model,
127-
up to 5MB.
128-
- Text Sentiment - TextSnippet, content up 500 characters, UTF-8
128+
NFC encoded.
129+
- Translation - TextSnippet, content up to 25,000 characters, UTF-8
129130
encoded.
131+
- Tables - Row, with column values matching the columns of the model,
132+
up to 5MB. Not available for FORECASTING
133+
134+
``prediction_type``.
130135
131136
Returns:
132137
Callable: A callable which accepts the appropriate
@@ -147,6 +152,7 @@ def batch_predict(self):
147152
Available for following ML problems:
148153
149154
- Video Classification
155+
- Video Object Tracking
150156
- Text Extraction
151157
- Tables
152158

automl/google/cloud/automl_v1beta1/proto/annotation_payload.proto

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018 Google LLC.
1+
// Copyright 2019 Google LLC.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,21 +17,20 @@ syntax = "proto3";
1717

1818
package google.cloud.automl.v1beta1;
1919

20-
import "google/api/annotations.proto";
2120
import "google/cloud/automl/v1beta1/classification.proto";
2221
import "google/cloud/automl/v1beta1/detection.proto";
2322
import "google/cloud/automl/v1beta1/tables.proto";
2423
import "google/cloud/automl/v1beta1/text_extraction.proto";
2524
import "google/cloud/automl/v1beta1/text_sentiment.proto";
2625
import "google/cloud/automl/v1beta1/translation.proto";
2726
import "google/protobuf/any.proto";
27+
import "google/api/annotations.proto";
2828

2929
option go_package = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1;automl";
3030
option java_multiple_files = true;
3131
option java_package = "com.google.cloud.automl.v1beta1";
3232
option php_namespace = "Google\\Cloud\\AutoMl\\V1beta1";
3333

34-
3534
// Contains annotation information that is relevant to AutoML.
3635
message AnnotationPayload {
3736
// Output only . Additional information about the annotation
@@ -50,6 +49,9 @@ message AnnotationPayload {
5049
// Returned for Video Classification predictions.
5150
VideoClassificationAnnotation video_classification = 9;
5251

52+
// Annotation details for video object tracking.
53+
VideoObjectTrackingAnnotation video_object_tracking = 8;
54+
5355
// Annotation details for text extraction.
5456
TextExtractionAnnotation text_extraction = 6;
5557

@@ -65,10 +67,11 @@ message AnnotationPayload {
6567
// ancestor dataset, or the dataset that was used to train the model in use.
6668
string annotation_spec_id = 1;
6769

68-
// Output only. The value of [AnnotationSpec.display_name][google.cloud.automl.v1beta1.AnnotationSpec.display_name] when the model
69-
// was trained. Because this field returns a value at model training time,
70-
// for different models trained using the same dataset, the returned value
71-
// could be different as model owner could update the display_name between
72-
// any two model training.
70+
// Output only. The value of
71+
// [display_name][google.cloud.automl.v1beta1.AnnotationSpec.display_name]
72+
// when the model was trained. Because this field returns a value at model
73+
// training time, for different models trained using the same dataset, the
74+
// returned value could be different as model owner could update the
75+
// `display_name` between any two model training.
7376
string display_name = 5;
7477
}

0 commit comments

Comments
 (0)