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

Commit

Permalink
feat: additional safe search confidence fields (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and callmehiphop committed Sep 16, 2019
1 parent cb2258a commit 31735a7
Show file tree
Hide file tree
Showing 12 changed files with 779 additions and 362 deletions.
103 changes: 68 additions & 35 deletions protos/google/cloud/vision/v1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package google.cloud.vision.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/cloud/vision/v1/geometry.proto";
import "google/cloud/vision/v1/product_search.proto";
import "google/cloud/vision/v1/text_annotation.proto";
Expand Down Expand Up @@ -47,8 +48,7 @@ service ImageAnnotator {
"https://www.googleapis.com/auth/cloud-vision";

// Run image detection and annotation for a batch of images.
rpc BatchAnnotateImages(BatchAnnotateImagesRequest)
returns (BatchAnnotateImagesResponse) {
rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse) {
option (google.api.http) = {
post: "/v1/images:annotate"
body: "*"
Expand All @@ -61,6 +61,7 @@ service ImageAnnotator {
body: "*"
}
};
option (google.api.method_signature) = "requests";
}

// Service that performs image detection and annotation for a batch of files.
Expand All @@ -70,8 +71,7 @@ service ImageAnnotator {
// AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each
// file provided and perform detection and annotation for each image
// extracted.
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest)
returns (BatchAnnotateFilesResponse) {
rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse) {
option (google.api.http) = {
post: "/v1/files:annotate"
body: "*"
Expand All @@ -84,6 +84,7 @@ service ImageAnnotator {
body: "*"
}
};
option (google.api.method_signature) = "requests";
}

// Run asynchronous image detection and annotation for a list of images.
Expand All @@ -95,8 +96,7 @@ service ImageAnnotator {
//
// This service will write image annotation outputs to json files in customer
// GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest)
returns (google.longrunning.Operation) {
rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/images:asyncBatchAnnotate"
body: "*"
Expand All @@ -109,6 +109,11 @@ service ImageAnnotator {
body: "*"
}
};
option (google.api.method_signature) = "requests,output_config";
option (google.longrunning.operation_info) = {
response_type: "AsyncBatchAnnotateImagesResponse"
metadata_type: "OperationMetadata"
};
}

// Run asynchronous image detection and annotation for a list of generic
Expand All @@ -117,8 +122,7 @@ service ImageAnnotator {
// `google.longrunning.Operations` interface.
// `Operation.metadata` contains `OperationMetadata` (metadata).
// `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest)
returns (google.longrunning.Operation) {
rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/files:asyncBatchAnnotate"
body: "*"
Expand All @@ -131,6 +135,11 @@ service ImageAnnotator {
body: "*"
}
};
option (google.api.method_signature) = "requests";
option (google.longrunning.operation_info) = {
response_type: "AsyncBatchAnnotateFilesResponse"
metadata_type: "OperationMetadata"
};
}
}

Expand Down Expand Up @@ -557,6 +566,30 @@ message SafeSearchAnnotation {
// covered nudity, lewd or provocative poses, or close-ups of sensitive
// body areas.
Likelihood racy = 9;

// Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means
// very confident.
float adult_confidence = 16;

// Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means
// very confident.
float spoof_confidence = 18;

// Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means
// very confident.
float medical_confidence = 20;

// Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means
// very confident.
float violence_confidence = 22;

// Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very
// confident.
float racy_confidence = 24;

// Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very
// confident.
float nsfw_confidence = 26;
}

// Rectangle determined by min and max `LatLng` pairs.
Expand Down Expand Up @@ -732,28 +765,10 @@ message AnnotateImageResponse {
ImageAnnotationContext context = 21;
}

// Response to a single file annotation request. A file may contain one or more
// images, which individually have their own responses.
message AnnotateFileResponse {
// Information about the file for which this response is generated.
InputConfig input_config = 1;

// Individual responses to images found within the file. This field will be
// empty if the `error` field is set.
repeated AnnotateImageResponse responses = 2;

// This field gives the total number of pages in the file.
int32 total_pages = 3;

// If set, represents the error message for the failed request. The
// `responses` field will not be set in this case.
google.rpc.Status error = 4;
}

// Multiple image annotation requests are batched into a single service call.
message BatchAnnotateImagesRequest {
// Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1;
// Required. Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand Down Expand Up @@ -804,11 +819,29 @@ message AnnotateFileRequest {
repeated int32 pages = 4;
}

// Response to a single file annotation request. A file may contain one or more
// images, which individually have their own responses.
message AnnotateFileResponse {
// Information about the file for which this response is generated.
InputConfig input_config = 1;

// Individual responses to images found within the file. This field will be
// empty if the `error` field is set.
repeated AnnotateImageResponse responses = 2;

// This field gives the total number of pages in the file.
int32 total_pages = 3;

// If set, represents the error message for the failed request. The
// `responses` field will not be set in this case.
google.rpc.Status error = 4;
}

// A list of requests to annotate files using the BatchAnnotateFiles API.
message BatchAnnotateFilesRequest {
// The list of file annotation requests. Right now we support only one
// Required. The list of file annotation requests. Right now we support only one
// AnnotateFileRequest in BatchAnnotateFilesRequest.
repeated AnnotateFileRequest requests = 1;
repeated AnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand Down Expand Up @@ -855,11 +888,11 @@ message AsyncAnnotateFileResponse {

// Request for async image annotation for a list of images.
message AsyncBatchAnnotateImagesRequest {
// Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1;
// Required. Individual image annotation requests for this batch.
repeated AnnotateImageRequest requests = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The desired output location and metadata (e.g. format).
OutputConfig output_config = 2;
OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand All @@ -885,8 +918,8 @@ message AsyncBatchAnnotateImagesResponse {
// Multiple async file annotation requests are batched into a single service
// call.
message AsyncBatchAnnotateFilesRequest {
// Individual async file annotation requests for this batch.
repeated AsyncAnnotateFileRequest requests = 1;
// Required. Individual async file annotation requests for this batch.
repeated AsyncAnnotateFileRequest requests = 1 [(google.api.field_behavior) = REQUIRED];

// Optional. Target project and location to make a call.
//
Expand Down
5 changes: 2 additions & 3 deletions protos/google/cloud/vision/v1/product_search.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ syntax = "proto3";

package google.cloud.vision.v1;

import "google/api/annotations.proto";
import "google/cloud/vision/v1/geometry.proto";
import "google/cloud/vision/v1/product_search_service.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/vision/v1;vision";
Expand All @@ -35,8 +35,7 @@ message ProductSearchParams {
// Optional. If it is not specified, system discretion will be applied.
BoundingPoly bounding_poly = 9;

// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to
// be searched for similar images.
// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images.
//
// Format is:
// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
Expand Down
Loading

0 comments on commit 31735a7

Please sign in to comment.