You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::vector<std::pair<int, float>> distances;
distances.reserve(samples.size());
auto dist_func = dlib::squared_euclidean_distance();
int idx = 0;
for (const auto& sample : samples) {
float dist = dist_func(sample, test_sample);
if (dist < tolerance)
distances.push_back({idx, dist});
idx++;
}
if (distances.size() == 0)
return -1;
std::sort(
distances.begin(), distances.end(),
[](const auto a, const auto b) { return a.second < b.second; }
);
int nIndext = distances[0].first;
auto cat = cats.find(nIndext);
if (cat == cats.end())return -1;
return cat->second;
}
`
The text was updated successfully, but these errors were encountered:
suddenly-ou
changed the title
I found a bug with classify. Classifier always gives me some result .
I found a bug with classify.cc .Classifier always gives me some result .
Aug 1, 2019
I changed some code。it can work normally。
`
int classify(
const std::vector& samples,
const std::unordered_map<int, int>& cats,
const descriptor& test_sample,
float tolerance
) {
if (samples.size() == 0)
return -1;
}
`
The text was updated successfully, but these errors were encountered: