evaluation.proto 7.6 KB

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