Skip to content
Snippets Groups Projects
Commit 01e15a37 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

REFAC: fix SVM classes issues

parent 029a6b28
No related branches found
No related tags found
No related merge requests found
......@@ -237,6 +237,9 @@ private:
/** Step of the detection grid */
unsigned int m_GridStep;
/** classification model */
ModelPointerType m_Model;
};
......
......@@ -36,8 +36,7 @@ PersistentObjectDetectionClassifier<TInputImage, TOutputVectorData, TLabel, TFun
m_NoClassLabel(0),
m_GridStep(10)
{
// Need 2 inputs : a vector image, and a SVMModel
this->SetNumberOfRequiredInputs(2);
this->SetNumberOfRequiredInputs(1);
// Have 2 outputs : the image created by Superclass, a vector data with points
this->SetNumberOfRequiredOutputs(3);
......@@ -86,7 +85,11 @@ void
PersistentObjectDetectionClassifier<TInputImage, TOutputVectorData, TLabel, TFunctionType>
::SetModel(ModelType* model)
{
this->SetNthInput(1, model);
if (model != m_Model)
{
m_Model = model;
this->Modified();
}
}
template <class TInputImage, class TOutputVectorData, class TLabel, class TFunctionType>
......@@ -94,11 +97,7 @@ const typename PersistentObjectDetectionClassifier<TInputImage, TOutputVectorDat
PersistentObjectDetectionClassifier<TInputImage, TOutputVectorData, TLabel, TFunctionType>
::GetModel(void) const
{
if(this->GetNumberOfInputs()<2)
{
return ITK_NULLPTR;
}
return static_cast<const ModelType*>(this->itk::ProcessObject::GetInput(1));
return m_Model;
}
template <class TInputImage, class TOutputVectorData, class TLabel, class TFunctionType>
......
......@@ -35,7 +35,7 @@ namespace otb {
* \sa otb::SVMModel
* \sa itk::InPlaceLabelMapFilter
*
* \ingroup OTBSVMLearning
* \ingroup OTBSupervised
*/
template<class TInputLabelMap>
class ITK_EXPORT LabelMapClassifier :
......
......@@ -238,9 +238,9 @@ public:
void SetConfidenceMode(unsigned int mode)
{
if (mode != m_ConfidenceMode)
if (m_ConfidenceMode != static_cast<ConfidenceMode>(mode) )
{
m_ConfidenceMode = mode;
m_ConfidenceMode = static_cast<ConfidenceMode>(mode);
this->m_ConfidenceIndex = this->HasProbabilities();
this->Modified();
}
......
......@@ -89,13 +89,13 @@ SVMMarginSampler< TSample, TModel >
while (iter != end && iterO != endO)
{
int i = 0;
typename SVMModelType::InputSampleType modelMeasurement;
typename SVMModelType::InputSampleType modelMeasurement(numberOfComponentsPerSample);
measurements = iter.GetMeasurementVector();
// otbMsgDevMacro( << "Loop on components " << svm_type );
for (i=0; i<numberOfComponentsPerSample; ++i)
{
modelMeasurement.PushBack(measurements[i]);
modelMeasurement[i] = measurements[i];
}
// Get distances to the hyperplanes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment