Commit 731597df authored by Ludovic Hussonnois's avatar Ludovic Hussonnois

COMP: Add check for empty unsupervised classifier.

parent 951a7888
......@@ -60,7 +60,9 @@ LearningApplicationBase<TInputValue,TOutputValue>
InitUnsupervisedClassifierParams();
std::vector<std::string> allClassifier = GetChoiceKeys("classifier");
m_UnsupervisedClassifier.assign(allClassifier.begin() + m_SupervisedClassifier.size(), allClassifier.end());
// Check for empty unsupervised classifier
if( allClassifier.size() > m_UnsupervisedClassifier.size() )
m_UnsupervisedClassifier.assign( allClassifier.begin() + m_SupervisedClassifier.size(), allClassifier.end() );
}
template <class TInputValue, class TOutputValue>
......@@ -68,10 +70,16 @@ typename LearningApplicationBase<TInputValue,TOutputValue>::ClassifierCategory
LearningApplicationBase<TInputValue,TOutputValue>
::GetClassifierCategory()
{
bool foundUnsupervised =
std::find(m_UnsupervisedClassifier.begin(), m_UnsupervisedClassifier.end(),
GetParameterString("classifier")) != m_UnsupervisedClassifier.end();
return foundUnsupervised ? Unsupervised : Supervised;
if( m_UnsupervisedClassifier.empty() )
{
return Supervised;
}
else
{
bool foundUnsupervised = std::find( m_UnsupervisedClassifier.begin(), m_UnsupervisedClassifier.end(),
GetParameterString( "classifier" ) ) != m_UnsupervisedClassifier.end();
return foundUnsupervised ? Unsupervised : Supervised;
}
}
template <class TInputValue, class TOutputValue>
......@@ -202,7 +210,7 @@ LearningApplicationBase<TInputValue,TOutputValue>
#endif
}
// OpenCV SVM implementation is buggy with linear kernel
// Users should use the libSVM implementation instead.
// else if (modelName == "svm")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment