blob: 47c4d0c97f30bb0677aaf33f4fab03b1a1bcdc75 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
syntax = "proto3";
package yandex.cloud.ai.vision.v1;
import "yandex/cloud/ai/vision/v1/text_detection.proto";
import "yandex/cloud/ai/vision/v1/classification.proto";
import "yandex/cloud/ai/vision/v1/face_detection.proto";
import "yandex/cloud/ai/vision/v1/image_copy_search.proto";
import "yandex/cloud/validation.proto";
import "google/api/annotations.proto";
import "google/rpc/status.proto";
option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/ai/vision/v1;vision";
option java_package = "yandex.cloud.api.ai.vision.v1";
// A set of methods for the Vision service.
service VisionService {
// Analyzes a batch of images and returns results with annotations.
rpc BatchAnalyze(BatchAnalyzeRequest) returns (BatchAnalyzeResponse) {
option (google.api.http) = { post: "/vision/v1/batchAnalyze" body: "*" };
}
}
message BatchAnalyzeRequest {
// A list of specifications. Each specification contains the file to analyze and features to use for analysis.
//
// Restrictions:
// * Supported file formats: `JPEG`, `PNG`.
// * Maximum file size: 1 MB.
// * Image size should not exceed 20M pixels (length x width).
repeated AnalyzeSpec analyze_specs = 1 [(size) = "1-8"];
// ID of the folder to which you have access.
// Required for authorization with a user account (see [yandex.cloud.iam.v1.UserAccount] resource).
// Don't specify this field if you make the request on behalf of a service account.
string folder_id = 2 [(length) = "<=50"];
}
message AnalyzeSpec {
reserved 2;
oneof source {
option (exactly_one) = true;
// Image content, represented as a stream of bytes.
// Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.
bytes content = 1 [(length) = "<=10485760"];
string signature = 5 [(length) = "<=16384"];
}
// Requested features to use for analysis.
//
// Max count of requested features for one file is 8.
repeated Feature features = 3 [(size) = "1-8"];
// [MIME type](https://en.wikipedia.org/wiki/Media_type) of content (for example, `` application/pdf ``).
string mime_type = 4 [(length) = "<=255"];
}
message Feature {
enum Type {
TYPE_UNSPECIFIED = 0;
// Text detection (OCR) feature.
TEXT_DETECTION = 1;
// Classification feature.
CLASSIFICATION = 2;
// Face detection feature.
FACE_DETECTION = 3;
// Image copy search.
IMAGE_COPY_SEARCH = 4;
}
// Type of requested feature.
Type type = 1;
oneof config {
// Required for the `CLASSIFICATION` type. Specifies configuration for the classification feature.
FeatureClassificationConfig classification_config = 2;
// Required for the `TEXT_DETECTION` type. Specifies configuration for the text detection (OCR) feature.
FeatureTextDetectionConfig text_detection_config = 3;
}
}
message FeatureClassificationConfig {
// Model to use for image classification.
string model = 1 [(length) = "<=256"];
}
message FeatureTextDetectionConfig {
// List of the languages to recognize text.
// Specified in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (for example, `ru`).
repeated string language_codes = 1 [(size) = "1-8", (length) = "<=3"];
// Model to use for text detection.
// Possible values:
// * `page` (default): this model is suitable for detecting multiple text entries in an image.
// * `line`: this model is suitable for cropped images with one line of text.
string model = 2 [(length) = "<=50"];
}
message BatchAnalyzeResponse {
// Request results.
// Results have the same order as specifications in the request.
repeated AnalyzeResult results = 1;
}
message AnalyzeResult {
// Results for each requested feature.
// Feature results have the same order as in the request.
repeated FeatureResult results = 2;
// Return error in case of error with file processing.
google.rpc.Status error = 1;
}
message FeatureResult {
oneof feature {
// Text detection (OCR) result.
TextAnnotation text_detection = 2;
// Classification result.
ClassAnnotation classification = 3;
// Face detection result.
FaceAnnotation face_detection = 4;
// Image Copy Search result.
ImageCopySearchAnnotation image_copy_search = 5;
}
// Return error in case of error during the specified feature processing.
google.rpc.Status error = 1;
}
|