MCPcopy Create free account
hub / github.com/BVLC/caffe / Classify

Method Classify

examples/cpp_classification/classification.cpp:105–117  ·  view source on GitHub ↗

Return the top N predictions. */

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.80

Calls 2

ArgmaxFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected