| 138 | } |
| 139 | |
| 140 | void PrintTopLabels_uint8(const char* label_file, uint8_t* data, int data_size, float scale, int zero_point) |
| 141 | { |
| 142 | std::vector<std::string> labels; |
| 143 | LoadLabelFile(labels, label_file); |
| 144 | |
| 145 | std::vector<float> result; |
| 146 | for(int i = 0; i < data_size; i++) |
| 147 | result.push_back((data[i] - zero_point) * scale); |
| 148 | |
| 149 | std::vector<int> top_N = Argmax(result, 5); |
| 150 | |
| 151 | for(unsigned int i = 0; i < top_N.size(); i++) |
| 152 | { |
| 153 | int idx = top_N[i]; |
| 154 | std::cout << std::fixed << std::setprecision(4) << result[idx] << " - \"" << labels[idx] << "\"\n"; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | bool run_tengine_library(const char* model_format, const int model_fnum, const char* proto_file, const char* model_file, |
| 159 | const char* label_file, const char* image_file, const int img_h, const int img_w, |
no test coverage detected