1/** 2 * Copyright 2019-2021 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package mindspore.irpb; 20option cc_enable_arenas = true; 21 22// The ANF IR define, include the tensor and graph define 23import "anf_ir.proto"; 24 25// Event Protocol buffer, Top define 26message Event { 27 // Timestamp 28 required double wall_time = 1; 29 30 // The step of train. 31 optional int64 step = 2; 32 33 oneof what { 34 // An event file was started, with the specified version. 35 // Now version is "MindSpore.Event:1" 36 string version = 3; 37 38 // GraphDef. 39 GraphProto graph_def = 4; 40 41 // Summary data 42 Summary summary = 5; 43 44 Explain explain = 6; 45 } 46} 47 48message LossLandscape{ 49 message Point { 50 optional TensorProto x=1; 51 optional TensorProto y=2; 52 optional TensorProto z=3; 53 } 54 55 message LossPath { 56 repeated int32 intervals = 1; // step intervals or epoch intervals 57 optional Point points =2; 58 } 59 60 message Metadata { 61 optional string decomposition = 1; 62 optional string unit = 2; // step or epoch 63 optional int32 step_per_epoch = 3; 64 } 65 66 optional Point landscape = 1; 67 optional LossPath loss_path = 2; 68 optional Metadata metadata = 3; // maybe only record by the first value 69 optional Point convergence_point = 4; 70 71} 72 73// A Summary is a set of named values that be produced regularly during training 74message Summary { 75 message Image { 76 // Dimensions of the image. 77 required int32 height = 1; 78 required int32 width = 2; 79 // Valid colorspace values are: 80 // 1 - grayscale type 81 // 2 - grayscale + alpha type 82 // 3 - RGB type 83 // 4 - RGBA type 84 // 5 - DIGITAL_YUV type 85 // 6 - BGRA type 86 required int32 colorspace = 3; 87 // Image data in encoded format. Now only support the RGB. 88 required bytes encoded_image = 4; 89 } 90 91 message Histogram { 92 message bucket{ 93 // Count number of values fallen in [left, left + width). 94 // For the right most bucket, range is [left, left + width]. 95 required double left = 1; 96 required double width = 2; 97 required int64 count = 3; 98 } 99 100 repeated bucket buckets = 1; 101 optional int64 nan_count = 2; 102 optional int64 pos_inf_count = 3; 103 optional int64 neg_inf_count = 4; 104 105 // max, min, sum will not take nan and inf into account. 106 // If there is no valid value in tensor, max will be nan, min will be nan, sum will be 0. 107 optional double max = 5; 108 optional double min = 6; 109 optional double sum = 7; 110 111 // total number of values, including nan and inf 112 optional int64 count = 8; 113 } 114 115 message Value { 116 // Tag name for the data. 117 required string tag = 1; 118 119 // Value associated with the tag. 120 oneof value { 121 float scalar_value = 3; 122 Image image = 4; 123 TensorProto tensor = 8; 124 Histogram histogram = 9; 125 LossLandscape loss_landscape = 10; 126 } 127 } 128 129 // Set of values for the summary. 130 repeated Value value = 1; 131} 132 133message Explain { 134 message Inference{ 135 repeated float ground_truth_prob = 1; 136 repeated int32 predicted_label = 2; 137 repeated float predicted_prob = 3; 138 repeated float ground_truth_prob_sd = 4; 139 repeated float ground_truth_prob_itl95_low = 5; 140 repeated float ground_truth_prob_itl95_hi = 6; 141 repeated float predicted_prob_sd = 7; 142 repeated float predicted_prob_itl95_low = 8; 143 repeated float predicted_prob_itl95_hi = 9; 144 } 145 146 message Explanation{ 147 optional string explain_method = 1; 148 optional int32 label = 2; 149 optional string heatmap_path = 3; 150 } 151 152 message Benchmark{ 153 optional string benchmark_method = 1; 154 optional string explain_method = 2; 155 optional float total_score = 3; 156 repeated float label_score = 4; 157 } 158 159 message Metadata{ 160 repeated string label = 1; 161 repeated string explain_method = 2; 162 repeated string benchmark_method = 3; 163 } 164 165 message HocLayer { 166 optional float prob = 1; 167 repeated int32 box = 2; // List of repeated x, y, w, h 168 } 169 170 message Hoc { 171 optional int32 label = 1; 172 optional string mask = 2; 173 repeated HocLayer layer = 3; 174 } 175 176 optional int32 sample_id = 1; 177 optional string image_path = 2; // The Metadata and image path must have one fill in 178 repeated int32 ground_truth_label = 3; 179 180 optional Inference inference = 4; 181 repeated Explanation explanation = 5; 182 repeated Benchmark benchmark = 6; 183 184 optional Metadata metadata = 7; 185 optional string status = 8; // enum value: run, end 186 187 repeated Hoc hoc = 9; // hierarchical occlusion counterfactual 188}