Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated CI config and run synth (#181)
* Re-generate library using /synth.py

* fix(test): v1 now supports object localization, use v1p1beta1 for tests that assert the method doesnt exist

* npm run prettier
  • Loading branch information
dpebot authored and JustinBeckwith committed Sep 4, 2018
1 parent 3e72501 commit 66c5f5c
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 55 deletions.
7 changes: 3 additions & 4 deletions .circleci/config.yml
Expand Up @@ -107,9 +107,7 @@ jobs:
steps:
- checkout
- run: *npm_install_and_link
- run:
name: Build documentation.
command: npm run docs
- run: npm run docs
sample_tests:
docker:
- image: 'node:8'
Expand Down Expand Up @@ -164,5 +162,6 @@ jobs:
user: node
steps:
- checkout
- run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- npm install
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- run: npm publish --access=public
1 change: 0 additions & 1 deletion .eslintignore
@@ -1,4 +1,3 @@
node_modules/*
samples/node_modules/*
src/**/doc/*
samples/system-test/*
4 changes: 2 additions & 2 deletions .jsdoc.js
@@ -1,5 +1,5 @@
/*!
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2018 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +36,7 @@ module.exports = {
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2017 Google, Inc.',
copyright: 'Copyright 2018 Google, LLC.',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/vision',
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/continuous/node8/lint.cfg
@@ -1,4 +1,4 @@
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-vision/.kokoro/lint.sh"
}
}
2 changes: 1 addition & 1 deletion .kokoro/docs.sh
Expand Up @@ -16,7 +16,7 @@

set -xeo pipefail

cd github/nodejs-vision
cd $(dirname $0)/..

npm install

Expand Down
2 changes: 1 addition & 1 deletion .kokoro/lint.sh
Expand Up @@ -16,7 +16,7 @@

set -xeo pipefail

cd github/nodejs-vision
cd $(dirname $0)/..

npm install

Expand Down
2 changes: 1 addition & 1 deletion .kokoro/samples-test.sh
Expand Up @@ -20,7 +20,7 @@ set -xeo pipefail
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export GCLOUD_PROJECT=long-door-651

cd github/nodejs-vision
cd $(dirname $0)/..

npm install

Expand Down
2 changes: 1 addition & 1 deletion .kokoro/system-test.sh
Expand Up @@ -19,7 +19,7 @@ set -xeo pipefail
# Setup service account credentials.
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json

cd github/nodejs-vision
cd $(dirname $0)/..

npm install

Expand Down
3 changes: 2 additions & 1 deletion .kokoro/test.bat
Expand Up @@ -14,7 +14,8 @@

@echo "Starting Windows build"

cd github/nodejs-vision
cd /d %~dp0
cd ..

call npm install || goto :error
call npm run test || goto :error
Expand Down
3 changes: 2 additions & 1 deletion .kokoro/test.sh
Expand Up @@ -16,7 +16,8 @@

set -xeo pipefail

cd github/nodejs-vision
cd $(dirname $0)/..

npm install
npm test
node_modules/.bin/codecov
27 changes: 27 additions & 0 deletions protos/google/cloud/vision/v1/image_annotator.proto
Expand Up @@ -103,6 +103,9 @@ message Feature {

// Run web detection.
WEB_DETECTION = 10;

// Run localizer for object detection.
OBJECT_LOCALIZATION = 19;
}

// The feature type.
Expand Down Expand Up @@ -410,6 +413,26 @@ message EntityAnnotation {
repeated Property properties = 9;
}

// Set of detected objects with bounding boxes.
message LocalizedObjectAnnotation {
// Object ID that should align with EntityAnnotation mid.
string mid = 1;

// The BCP-47 language code, such as "en-US" or "sr-Latn". For more
// information, see
// http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
string language_code = 2;

// Object name, expressed in its `language_code` language.
string name = 3;

// Score of the result. Range [0, 1].
float score = 4;

// Image region to which this object belongs. This must be populated.
BoundingPoly bounding_poly = 5;
}

// Set of features pertaining to the image, computed by computer vision
// methods over safe-search verticals (for example, adult, spoof, medical,
// violence).
Expand Down Expand Up @@ -569,6 +592,10 @@ message AnnotateImageResponse {
// If present, label detection has completed successfully.
repeated EntityAnnotation label_annotations = 4;

// If present, localized object detection has completed successfully.
// This will be sorted descending by confidence score.
repeated LocalizedObjectAnnotation localized_object_annotations = 22;

// If present, text (OCR) detection has completed successfully.
repeated EntityAnnotation text_annotations = 5;

Expand Down
8 changes: 5 additions & 3 deletions samples/system-test/detect.test.js
Expand Up @@ -215,7 +215,7 @@ test(`should detect similar web images in a local file`, async t => {
t.true(output.includes('Description: Google Cloud Platform'));
}

if (webDetection.bestGuessLabels.length) {
if (webDetection.bestGuessLabels.length) {
t.true(output.includes('Best guess labels found'));
t.true(output.includes('Label:'));
}
Expand All @@ -227,7 +227,9 @@ test(`should detect similar web images in a remote file`, async t => {
cwd
);

const [results] = await client.webDetection(`gs://${bucketName}/${files[5].name}`);
const [results] = await client.webDetection(
`gs://${bucketName}/${files[5].name}`
);
const webDetection = results[0].webDetection;

if (webDetection.fullMatchingImages.length) {
Expand All @@ -243,7 +245,7 @@ test(`should detect similar web images in a remote file`, async t => {
t.true(output.includes('Description: Google Cloud Platform'));
}

if (webDetection.bestGuessLabels.length) {
if (webDetection.bestGuessLabels.length) {
t.true(output.includes('Best guess labels found'));
t.true(output.includes('Label:'));
}
Expand Down
43 changes: 42 additions & 1 deletion src/v1/doc/google/cloud/vision/v1/doc_image_annotator.js
Expand Up @@ -107,7 +107,12 @@ var Feature = {
/**
* Run web detection.
*/
WEB_DETECTION: 10
WEB_DETECTION: 10,

/**
* Run localizer for object detection.
*/
OBJECT_LOCALIZATION: 19
}
};

Expand Down Expand Up @@ -569,6 +574,36 @@ var EntityAnnotation = {
// This is for documentation. Actual contents will be loaded by gRPC.
};

/**
* Set of detected objects with bounding boxes.
*
* @property {string} mid
* Object ID that should align with EntityAnnotation mid.
*
* @property {string} languageCode
* The BCP-47 language code, such as "en-US" or "sr-Latn". For more
* information, see
* http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
*
* @property {string} name
* Object name, expressed in its `language_code` language.
*
* @property {number} score
* Score of the result. Range [0, 1].
*
* @property {Object} boundingPoly
* Image region to which this object belongs. This must be populated.
*
* This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly}
*
* @typedef LocalizedObjectAnnotation
* @memberof google.cloud.vision.v1
* @see [google.cloud.vision.v1.LocalizedObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto}
*/
var LocalizedObjectAnnotation = {
// This is for documentation. Actual contents will be loaded by gRPC.
};

/**
* Set of features pertaining to the image, computed by computer vision
* methods over safe-search verticals (for example, adult, spoof, medical,
Expand Down Expand Up @@ -869,6 +904,12 @@ var ImageAnnotationContext = {
*
* This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1.EntityAnnotation}
*
* @property {Object[]} localizedObjectAnnotations
* If present, localized object detection has completed successfully.
* This will be sorted descending by confidence score.
*
* This object should have the same structure as [LocalizedObjectAnnotation]{@link google.cloud.vision.v1.LocalizedObjectAnnotation}
*
* @property {Object[]} textAnnotations
* If present, text (OCR) detection has completed successfully.
*
Expand Down
21 changes: 13 additions & 8 deletions src/v1/doc/google/protobuf/doc_any.js
Expand Up @@ -97,17 +97,18 @@
* }
*
* @property {string} typeUrl
* A URL/resource name whose content describes the type of the
* serialized protocol buffer message.
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* For URLs which use the scheme `http`, `https`, or no scheme, the
* following restrictions and interpretations apply:
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * The last segment of the URL's path must represent the fully
* qualified name of the type (as in `path/google.protobuf.Duration`).
* The name should be in a canonical form (e.g., leading "." is
* not accepted).
* * An HTTP GET on the URL must yield a google.protobuf.Type
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
Expand All @@ -116,6 +117,10 @@
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
Expand Down
21 changes: 13 additions & 8 deletions src/v1p1beta1/doc/google/protobuf/doc_any.js
Expand Up @@ -97,17 +97,18 @@
* }
*
* @property {string} typeUrl
* A URL/resource name whose content describes the type of the
* serialized protocol buffer message.
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* For URLs which use the scheme `http`, `https`, or no scheme, the
* following restrictions and interpretations apply:
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * The last segment of the URL's path must represent the fully
* qualified name of the type (as in `path/google.protobuf.Duration`).
* The name should be in a canonical form (e.g., leading "." is
* not accepted).
* * An HTTP GET on the URL must yield a google.protobuf.Type
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
Expand All @@ -116,6 +117,10 @@
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
Expand Down
21 changes: 13 additions & 8 deletions src/v1p2beta1/doc/google/protobuf/doc_any.js
Expand Up @@ -97,17 +97,18 @@
* }
*
* @property {string} typeUrl
* A URL/resource name whose content describes the type of the
* serialized protocol buffer message.
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* For URLs which use the scheme `http`, `https`, or no scheme, the
* following restrictions and interpretations apply:
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * The last segment of the URL's path must represent the fully
* qualified name of the type (as in `path/google.protobuf.Duration`).
* The name should be in a canonical form (e.g., leading "." is
* not accepted).
* * An HTTP GET on the URL must yield a google.protobuf.Type
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
Expand All @@ -116,6 +117,10 @@
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
Expand Down
21 changes: 13 additions & 8 deletions src/v1p3beta1/doc/google/protobuf/doc_any.js
Expand Up @@ -97,17 +97,18 @@
* }
*
* @property {string} typeUrl
* A URL/resource name whose content describes the type of the
* serialized protocol buffer message.
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* For URLs which use the scheme `http`, `https`, or no scheme, the
* following restrictions and interpretations apply:
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * The last segment of the URL's path must represent the fully
* qualified name of the type (as in `path/google.protobuf.Duration`).
* The name should be in a canonical form (e.g., leading "." is
* not accepted).
* * An HTTP GET on the URL must yield a google.protobuf.Type
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
Expand All @@ -116,6 +117,10 @@
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
Expand Down

0 comments on commit 66c5f5c

Please sign in to comment.