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

Function PrintTopLabels

internal/bin/classification.cpp:122–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void PrintTopLabels(const char* label_file, float* data)
123{
124 // load labels
125 std::vector<std::string> labels;
126 LoadLabelFile(labels, label_file);
127
128 float* end = data + 1000;
129 std::vector<float> result(data, end);
130 std::vector<int> top_N = Argmax(result, PRINT_TOP_NUM);
131
132 for(unsigned int i = 0; i < top_N.size(); i++)
133 {
134 int idx = top_N[i];
135
136 std::cout << std::fixed << std::setprecision(4) << result[idx] << " - \"" << labels[idx] << "\"\n";
137 }
138}
139
140void PrintTopLabels_uint8(const char* label_file, uint8_t* data, int data_size, float scale, int zero_point)
141{

Callers 1

run_tengine_libraryFunction · 0.70

Calls 3

LoadLabelFileFunction · 0.70
ArgmaxFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected