evaluation_job.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.cloud.datalabeling.v1beta1;
  17. import "google/api/resource.proto";
  18. import "google/cloud/datalabeling/v1beta1/dataset.proto";
  19. import "google/cloud/datalabeling/v1beta1/evaluation.proto";
  20. import "google/cloud/datalabeling/v1beta1/human_annotation_config.proto";
  21. import "google/protobuf/timestamp.proto";
  22. import "google/rpc/status.proto";
  23. option csharp_namespace = "Google.Cloud.DataLabeling.V1Beta1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1;datalabeling";
  25. option java_multiple_files = true;
  26. option java_package = "com.google.cloud.datalabeling.v1beta1";
  27. option php_namespace = "Google\\Cloud\\DataLabeling\\V1beta1";
  28. option ruby_package = "Google::Cloud::DataLabeling::V1beta1";
  29. // Defines an evaluation job that runs periodically to generate
  30. // [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. [Creating an evaluation
  31. // job](/ml-engine/docs/continuous-evaluation/create-job) is the starting point
  32. // for using continuous evaluation.
  33. message EvaluationJob {
  34. option (google.api.resource) = {
  35. type: "datalabeling.googleapis.com/EvaluationJob"
  36. pattern: "projects/{project}/evaluationJobs/{evaluation_job}"
  37. };
  38. // State of the job.
  39. enum State {
  40. STATE_UNSPECIFIED = 0;
  41. // The job is scheduled to run at the [configured interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. You
  42. // can [pause][google.cloud.datalabeling.v1beta1.DataLabelingService.PauseEvaluationJob] or
  43. // [delete][google.cloud.datalabeling.v1beta1.DataLabelingService.DeleteEvaluationJob] the job.
  44. //
  45. // When the job is in this state, it samples prediction input and output
  46. // from your model version into your BigQuery table as predictions occur.
  47. SCHEDULED = 1;
  48. // The job is currently running. When the job runs, Data Labeling Service
  49. // does several things:
  50. //
  51. // 1. If you have configured your job to use Data Labeling Service for
  52. // ground truth labeling, the service creates a
  53. // [Dataset][google.cloud.datalabeling.v1beta1.Dataset] and a labeling task for all data sampled
  54. // since the last time the job ran. Human labelers provide ground truth
  55. // labels for your data. Human labeling may take hours, or even days,
  56. // depending on how much data has been sampled. The job remains in the
  57. // `RUNNING` state during this time, and it can even be running multiple
  58. // times in parallel if it gets triggered again (for example 24 hours
  59. // later) before the earlier run has completed. When human labelers have
  60. // finished labeling the data, the next step occurs.
  61. // <br><br>
  62. // If you have configured your job to provide your own ground truth
  63. // labels, Data Labeling Service still creates a [Dataset][google.cloud.datalabeling.v1beta1.Dataset] for newly
  64. // sampled data, but it expects that you have already added ground truth
  65. // labels to the BigQuery table by this time. The next step occurs
  66. // immediately.
  67. //
  68. // 2. Data Labeling Service creates an [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] by comparing your
  69. // model version's predictions with the ground truth labels.
  70. //
  71. // If the job remains in this state for a long time, it continues to sample
  72. // prediction data into your BigQuery table and will run again at the next
  73. // interval, even if it causes the job to run multiple times in parallel.
  74. RUNNING = 2;
  75. // The job is not sampling prediction input and output into your BigQuery
  76. // table and it will not run according to its schedule. You can
  77. // [resume][google.cloud.datalabeling.v1beta1.DataLabelingService.ResumeEvaluationJob] the job.
  78. PAUSED = 3;
  79. // The job has this state right before it is deleted.
  80. STOPPED = 4;
  81. }
  82. // Output only. After you create a job, Data Labeling Service assigns a name
  83. // to the job with the following format:
  84. //
  85. // "projects/<var>{project_id}</var>/evaluationJobs/<var>{evaluation_job_id}</var>"
  86. string name = 1;
  87. // Required. Description of the job. The description can be up to 25,000
  88. // characters long.
  89. string description = 2;
  90. // Output only. Describes the current state of the job.
  91. State state = 3;
  92. // Required. Describes the interval at which the job runs. This interval must
  93. // be at least 1 day, and it is rounded to the nearest day. For example, if
  94. // you specify a 50-hour interval, the job runs every 2 days.
  95. //
  96. // You can provide the schedule in
  97. // [crontab format](/scheduler/docs/configuring/cron-job-schedules) or in an
  98. // [English-like
  99. // format](/appengine/docs/standard/python/config/cronref#schedule_format).
  100. //
  101. // Regardless of what you specify, the job will run at 10:00 AM UTC. Only the
  102. // interval from this schedule is used, not the specific time of day.
  103. string schedule = 4;
  104. // Required. The [AI Platform Prediction model
  105. // version](/ml-engine/docs/prediction-overview) to be evaluated. Prediction
  106. // input and output is sampled from this model version. When creating an
  107. // evaluation job, specify the model version in the following format:
  108. //
  109. // "projects/<var>{project_id}</var>/models/<var>{model_name}</var>/versions/<var>{version_name}</var>"
  110. //
  111. // There can only be one evaluation job per model version.
  112. string model_version = 5;
  113. // Required. Configuration details for the evaluation job.
  114. EvaluationJobConfig evaluation_job_config = 6;
  115. // Required. Name of the [AnnotationSpecSet][google.cloud.datalabeling.v1beta1.AnnotationSpecSet] describing all the
  116. // labels that your machine learning model outputs. You must create this
  117. // resource before you create an evaluation job and provide its name in the
  118. // following format:
  119. //
  120. // "projects/<var>{project_id}</var>/annotationSpecSets/<var>{annotation_spec_set_id}</var>"
  121. string annotation_spec_set = 7;
  122. // Required. Whether you want Data Labeling Service to provide ground truth
  123. // labels for prediction input. If you want the service to assign human
  124. // labelers to annotate your data, set this to `true`. If you want to provide
  125. // your own ground truth labels in the evaluation job's BigQuery table, set
  126. // this to `false`.
  127. bool label_missing_ground_truth = 8;
  128. // Output only. Every time the evaluation job runs and an error occurs, the
  129. // failed attempt is appended to this array.
  130. repeated Attempt attempts = 9;
  131. // Output only. Timestamp of when this evaluation job was created.
  132. google.protobuf.Timestamp create_time = 10;
  133. }
  134. // Configures specific details of how a continuous evaluation job works. Provide
  135. // this configuration when you create an EvaluationJob.
  136. message EvaluationJobConfig {
  137. // Required. Details for how you want human reviewers to provide ground truth
  138. // labels.
  139. oneof human_annotation_request_config {
  140. // Specify this field if your model version performs image classification or
  141. // general classification.
  142. //
  143. // `annotationSpecSet` in this configuration must match
  144. // [EvaluationJob.annotationSpecSet][google.cloud.datalabeling.v1beta1.EvaluationJob.annotation_spec_set].
  145. // `allowMultiLabel` in this configuration must match
  146. // `classificationMetadata.isMultiLabel` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config].
  147. ImageClassificationConfig image_classification_config = 4;
  148. // Specify this field if your model version performs image object detection
  149. // (bounding box detection).
  150. //
  151. // `annotationSpecSet` in this configuration must match
  152. // [EvaluationJob.annotationSpecSet][google.cloud.datalabeling.v1beta1.EvaluationJob.annotation_spec_set].
  153. BoundingPolyConfig bounding_poly_config = 5;
  154. // Specify this field if your model version performs text classification.
  155. //
  156. // `annotationSpecSet` in this configuration must match
  157. // [EvaluationJob.annotationSpecSet][google.cloud.datalabeling.v1beta1.EvaluationJob.annotation_spec_set].
  158. // `allowMultiLabel` in this configuration must match
  159. // `classificationMetadata.isMultiLabel` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config].
  160. TextClassificationConfig text_classification_config = 8;
  161. }
  162. // Rquired. Details for the sampled prediction input. Within this
  163. // configuration, there are requirements for several fields:
  164. //
  165. // * `dataType` must be one of `IMAGE`, `TEXT`, or `GENERAL_DATA`.
  166. // * `annotationType` must be one of `IMAGE_CLASSIFICATION_ANNOTATION`,
  167. // `TEXT_CLASSIFICATION_ANNOTATION`, `GENERAL_CLASSIFICATION_ANNOTATION`,
  168. // or `IMAGE_BOUNDING_BOX_ANNOTATION` (image object detection).
  169. // * If your machine learning model performs classification, you must specify
  170. // `classificationMetadata.isMultiLabel`.
  171. // * You must specify `bigquerySource` (not `gcsSource`).
  172. InputConfig input_config = 1;
  173. // Required. Details for calculating evaluation metrics and creating
  174. // [Evaulations][google.cloud.datalabeling.v1beta1.Evaluation]. If your model version performs image object
  175. // detection, you must specify the `boundingBoxEvaluationOptions` field within
  176. // this configuration. Otherwise, provide an empty object for this
  177. // configuration.
  178. EvaluationConfig evaluation_config = 2;
  179. // Optional. Details for human annotation of your data. If you set
  180. // [labelMissingGroundTruth][google.cloud.datalabeling.v1beta1.EvaluationJob.label_missing_ground_truth] to
  181. // `true` for this evaluation job, then you must specify this field. If you
  182. // plan to provide your own ground truth labels, then omit this field.
  183. //
  184. // Note that you must create an [Instruction][google.cloud.datalabeling.v1beta1.Instruction] resource before you can
  185. // specify this field. Provide the name of the instruction resource in the
  186. // `instruction` field within this configuration.
  187. HumanAnnotationConfig human_annotation_config = 3;
  188. // Required. Prediction keys that tell Data Labeling Service where to find the
  189. // data for evaluation in your BigQuery table. When the service samples
  190. // prediction input and output from your model version and saves it to
  191. // BigQuery, the data gets stored as JSON strings in the BigQuery table. These
  192. // keys tell Data Labeling Service how to parse the JSON.
  193. //
  194. // You can provide the following entries in this field:
  195. //
  196. // * `data_json_key`: the data key for prediction input. You must provide
  197. // either this key or `reference_json_key`.
  198. // * `reference_json_key`: the data reference key for prediction input. You
  199. // must provide either this key or `data_json_key`.
  200. // * `label_json_key`: the label key for prediction output. Required.
  201. // * `label_score_json_key`: the score key for prediction output. Required.
  202. // * `bounding_box_json_key`: the bounding box key for prediction output.
  203. // Required if your model version perform image object detection.
  204. //
  205. // Learn [how to configure prediction
  206. // keys](/ml-engine/docs/continuous-evaluation/create-job#prediction-keys).
  207. map<string, string> bigquery_import_keys = 9;
  208. // Required. The maximum number of predictions to sample and save to BigQuery
  209. // during each [evaluation interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. This limit
  210. // overrides `example_sample_percentage`: even if the service has not sampled
  211. // enough predictions to fulfill `example_sample_perecentage` during an
  212. // interval, it stops sampling predictions when it meets this limit.
  213. int32 example_count = 10;
  214. // Required. Fraction of predictions to sample and save to BigQuery during
  215. // each [evaluation interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. For example, 0.1 means
  216. // 10% of predictions served by your model version get saved to BigQuery.
  217. double example_sample_percentage = 11;
  218. // Optional. Configuration details for evaluation job alerts. Specify this
  219. // field if you want to receive email alerts if the evaluation job finds that
  220. // your predictions have low mean average precision during a run.
  221. EvaluationJobAlertConfig evaluation_job_alert_config = 13;
  222. }
  223. // Provides details for how an evaluation job sends email alerts based on the
  224. // results of a run.
  225. message EvaluationJobAlertConfig {
  226. // Required. An email address to send alerts to.
  227. string email = 1;
  228. // Required. A number between 0 and 1 that describes a minimum mean average
  229. // precision threshold. When the evaluation job runs, if it calculates that
  230. // your model version's predictions from the recent interval have
  231. // [meanAveragePrecision][google.cloud.datalabeling.v1beta1.PrCurve.mean_average_precision] below this
  232. // threshold, then it sends an alert to your specified email.
  233. double min_acceptable_mean_average_precision = 2;
  234. }
  235. // Records a failed evaluation job run.
  236. message Attempt {
  237. google.protobuf.Timestamp attempt_time = 1;
  238. // Details of errors that occurred.
  239. repeated google.rpc.Status partial_failures = 2;
  240. }