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

Method Classify

examples/caffe_wrapper/cpp_classification/classification.cpp:101–115  ·  view source on GitHub ↗

Return the top N predictions. */

Source from the content-addressed store, hash-verified

99
100/* Return the top N predictions. */
101std::vector<Prediction> Classifier::Classify(const cv::Mat& img, int N)
102{
103 std::vector<float> output = Predict(img);
104
105 N = std::min<int>(labels_.size(), N);
106 std::vector<int> maxN = Argmax(output, N);
107 std::vector<Prediction> predictions;
108 for(int i = 0; i < N; ++i)
109 {
110 int idx = maxN[i];
111 predictions.push_back(std::make_pair(labels_[idx], output[idx]));
112 }
113
114 return predictions;
115}
116
117/* Load the mean file in binaryproto format. */
118void Classifier::SetMean(const string& mean_file)

Callers 1

mainFunction · 0.80

Calls 2

ArgmaxFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected