MCPcopy Create free account
hub / github.com/OAID/Tengine / PrintTopLabels

Function PrintTopLabels

examples/tengine_model/classification/classification_tf.cpp:134–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void 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
152bool 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)

Callers 1

run_tengine_libraryFunction · 0.70

Calls 3

LoadLabelFileFunction · 0.70
ArgmaxFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected