opencvtest3/classfication.cpp
static std::vector<int> Argmax(const std::vector<float>& v, int N) {
	std::vector<std::pair<float, int> > pairs;
	for (size_t i = 0; i < v.size(); ++i)
		pairs.push_back(std::make_pair(v[i], static_cast<int>(i)));
	std::partial_sort(pairs.begin(), pairs.begin() + N, pairs.end(), PairCompare);

	std::vector<int> result;
	for (int i = 0; i < N; ++i)
		result.push_back(pairs[i].second);
	return result;
}
/* Return the indices of the top N values of vector v. */
Return the indices of the top N values of vector v.
Return the indices of the top N values of vector v .
static std::vector<int> Argmax(const std::vector<float>& v, int N) {
	std::vector<std::pair<float, int> > pairs;
	for (size_t i = 0; i < v.size(); ++i)
		pairs.push_back(std::make_pair(v[i], static_cast<int>(i)));
	std::partial_sort(pairs.begin(), pairs.begin() + N, pairs.end(), PairCompare);
	std::vector<int> result;
	for (int i = 0; i < N; ++i)
		result.push_back(pairs[i].second);
	return result;
}
static std :: vector < int > Argmax ( const std :: vector < float > & v , int N ) { std :: vector < std :: pair < float , int > > pairs ; for ( size_t i = 0 ; i < v . size ( ) ; ++ i ) pairs . push_back ( std :: make_pair ( v [ i ] , static_cast < int > ( i ) ) ) ; std :: partial_sort ( pairs . begin ( ) , pairs . begin ( ) + N , pairs . end ( ) , PairCompare ) ; std :: vector < int > result ; for ( int i = 0 ; i < N ; ++ i ) result . push_back ( pairs [ i ] . second ) ; return result ; }
Return the indices of the top N values of vector v.
Return the indices of the top N values of vector v .