| 132 | } |
| 133 | |
| 134 | void PrintTopLabels(const char* label_file, float* data) |
| 135 | { |
| 136 | // load labels |
| 137 | std::vector<std::string> labels; |
| 138 | LoadLabelFile(labels, label_file); |
| 139 | |
| 140 | float* end = data + 1000; |
| 141 | std::vector<float> result(data, end); |
| 142 | std::vector<int> top_N = Argmax(result, PRINT_TOP_NUM); |
| 143 | |
| 144 | for(unsigned int i = 0; i < top_N.size(); i++) |
| 145 | { |
| 146 | int idx = top_N[i]; |
| 147 | |
| 148 | std::cout << std::fixed << std::setprecision(4) << result[idx] << " - \"" << labels[idx] << "\"\n"; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | bool run_tengine_library(const char* model_name, const char* tm_file, const char* label_file, const char* image_file, |
| 153 | int img_h, int img_w, const float* mean, float scale, int repeat_count) |
no test coverage detected