evaluation.proto 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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/annotations.proto";
  18. import "google/api/resource.proto";
  19. import "google/cloud/datalabeling/v1beta1/annotation.proto";
  20. import "google/cloud/datalabeling/v1beta1/annotation_spec_set.proto";
  21. import "google/protobuf/timestamp.proto";
  22. option csharp_namespace = "Google.Cloud.DataLabeling.V1Beta1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1;datalabeling";
  24. option java_multiple_files = true;
  25. option java_package = "com.google.cloud.datalabeling.v1beta1";
  26. option php_namespace = "Google\\Cloud\\DataLabeling\\V1beta1";
  27. option ruby_package = "Google::Cloud::DataLabeling::V1beta1";
  28. // Describes an evaluation between a machine learning model's predictions and
  29. // ground truth labels. Created when an [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] runs successfully.
  30. message Evaluation {
  31. option (google.api.resource) = {
  32. type: "datalabeling.googleapis.com/Evaluation"
  33. pattern: "projects/{project}/datasets/{dataset}/evaluations/{evaluation}"
  34. };
  35. // Output only. Resource name of an evaluation. The name has the following
  36. // format:
  37. //
  38. // "projects/<var>{project_id}</var>/datasets/<var>{dataset_id}</var>/evaluations/<var>{evaluation_id</var>}'
  39. string name = 1;
  40. // Output only. Options used in the evaluation job that created this
  41. // evaluation.
  42. EvaluationConfig config = 2;
  43. // Output only. Timestamp for when the evaluation job that created this
  44. // evaluation ran.
  45. google.protobuf.Timestamp evaluation_job_run_time = 3;
  46. // Output only. Timestamp for when this evaluation was created.
  47. google.protobuf.Timestamp create_time = 4;
  48. // Output only. Metrics comparing predictions to ground truth labels.
  49. EvaluationMetrics evaluation_metrics = 5;
  50. // Output only. Type of task that the model version being evaluated performs,
  51. // as defined in the
  52. //
  53. // [evaluationJobConfig.inputConfig.annotationType][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config]
  54. // field of the evaluation job that created this evaluation.
  55. AnnotationType annotation_type = 6;
  56. // Output only. The number of items in the ground truth dataset that were used
  57. // for this evaluation. Only populated when the evaulation is for certain
  58. // AnnotationTypes.
  59. int64 evaluated_item_count = 7;
  60. }
  61. // Configuration details used for calculating evaluation metrics and creating an
  62. // [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation].
  63. message EvaluationConfig {
  64. // Vertical specific options for general metrics.
  65. oneof vertical_option {
  66. // Only specify this field if the related model performs image object
  67. // detection (`IMAGE_BOUNDING_BOX_ANNOTATION`). Describes how to evaluate
  68. // bounding boxes.
  69. BoundingBoxEvaluationOptions bounding_box_evaluation_options = 1;
  70. }
  71. }
  72. // Options regarding evaluation between bounding boxes.
  73. message BoundingBoxEvaluationOptions {
  74. // Minimum
  75. // [intersection-over-union
  76. //
  77. // (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union)
  78. // required for 2 bounding boxes to be considered a match. This must be a
  79. // number between 0 and 1.
  80. float iou_threshold = 1;
  81. }
  82. message EvaluationMetrics {
  83. // Common metrics covering most general cases.
  84. oneof metrics {
  85. ClassificationMetrics classification_metrics = 1;
  86. ObjectDetectionMetrics object_detection_metrics = 2;
  87. }
  88. }
  89. // Metrics calculated for a classification model.
  90. message ClassificationMetrics {
  91. // Precision-recall curve based on ground truth labels, predicted labels, and
  92. // scores for the predicted labels.
  93. PrCurve pr_curve = 1;
  94. // Confusion matrix of predicted labels vs. ground truth labels.
  95. ConfusionMatrix confusion_matrix = 2;
  96. }
  97. // Metrics calculated for an image object detection (bounding box) model.
  98. message ObjectDetectionMetrics {
  99. // Precision-recall curve.
  100. PrCurve pr_curve = 1;
  101. }
  102. message PrCurve {
  103. message ConfidenceMetricsEntry {
  104. // Threshold used for this entry.
  105. //
  106. // For classification tasks, this is a classification threshold: a
  107. // predicted label is categorized as positive or negative (in the context of
  108. // this point on the PR curve) based on whether the label's score meets this
  109. // threshold.
  110. //
  111. // For image object detection (bounding box) tasks, this is the
  112. // [intersection-over-union
  113. //
  114. // (IOU)](/vision/automl/object-detection/docs/evaluate#intersection-over-union)
  115. // threshold for the context of this point on the PR curve.
  116. float confidence_threshold = 1;
  117. // Recall value.
  118. float recall = 2;
  119. // Precision value.
  120. float precision = 3;
  121. // Harmonic mean of recall and precision.
  122. float f1_score = 4;
  123. // Recall value for entries with label that has highest score.
  124. float recall_at1 = 5;
  125. // Precision value for entries with label that has highest score.
  126. float precision_at1 = 6;
  127. // The harmonic mean of [recall_at1][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.recall_at1] and [precision_at1][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.precision_at1].
  128. float f1_score_at1 = 7;
  129. // Recall value for entries with label that has highest 5 scores.
  130. float recall_at5 = 8;
  131. // Precision value for entries with label that has highest 5 scores.
  132. float precision_at5 = 9;
  133. // The harmonic mean of [recall_at5][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.recall_at5] and [precision_at5][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.precision_at5].
  134. float f1_score_at5 = 10;
  135. }
  136. // The annotation spec of the label for which the precision-recall curve
  137. // calculated. If this field is empty, that means the precision-recall curve
  138. // is an aggregate curve for all labels.
  139. AnnotationSpec annotation_spec = 1;
  140. // Area under the precision-recall curve. Not to be confused with area under
  141. // a receiver operating characteristic (ROC) curve.
  142. float area_under_curve = 2;
  143. // Entries that make up the precision-recall graph. Each entry is a "point" on
  144. // the graph drawn for a different `confidence_threshold`.
  145. repeated ConfidenceMetricsEntry confidence_metrics_entries = 3;
  146. // Mean average prcision of this curve.
  147. float mean_average_precision = 4;
  148. }
  149. // Confusion matrix of the model running the classification. Only applicable
  150. // when the metrics entry aggregates multiple labels. Not applicable when the
  151. // entry is for a single label.
  152. message ConfusionMatrix {
  153. message ConfusionMatrixEntry {
  154. // The annotation spec of a predicted label.
  155. AnnotationSpec annotation_spec = 1;
  156. // Number of items predicted to have this label. (The ground truth label for
  157. // these items is the `Row.annotationSpec` of this entry's parent.)
  158. int32 item_count = 2;
  159. }
  160. // A row in the confusion matrix. Each entry in this row has the same
  161. // ground truth label.
  162. message Row {
  163. // The annotation spec of the ground truth label for this row.
  164. AnnotationSpec annotation_spec = 1;
  165. // A list of the confusion matrix entries. One entry for each possible
  166. // predicted label.
  167. repeated ConfusionMatrixEntry entries = 2;
  168. }
  169. repeated Row row = 1;
  170. }