Skip to content
Snippets Groups Projects
Commit 6f32ff41 authored by Ludovic Hussonnois's avatar Ludovic Hussonnois
Browse files

ENH: Add Unsupervised initialization and test for Learning applications.

parent 5db89e84
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,10 @@ otb_create_application(
SOURCES otbTrainVectorClassifier.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES})
otb_create_application(
NAME TrainVectorClustering
SOURCES otbTrainVectorClustering.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES})
otb_create_application(
NAME ComputeConfusionMatrix
......
......@@ -110,7 +110,7 @@ public:
// Machine Learning models
typedef otb::MachineLearningModelFactory<
InputValueType, OutputValueType> ModelFactoryType;
InputValueType, OutputValueType> ModelFactoryType;
typedef typename ModelFactoryType::MachineLearningModelTypePointer ModelPointerType;
typedef typename ModelFactoryType::MachineLearningModelType ModelType;
......
......@@ -93,7 +93,6 @@ LearningApplicationBase<TInputValue,TOutputValue>
#ifdef OTB_USE_SHARK
InitSharkRandomForestsParams();
InitSharkKMeansParams();
#endif
}
......@@ -102,7 +101,9 @@ void
LearningApplicationBase<TInputValue,TOutputValue>
::InitUnsupervisedClassifierParams()
{
#ifdef OTB_USE_SHARK
InitSharkKMeansParams();
#endif
}
template <class TInputValue, class TOutputValue>
......
......@@ -249,7 +249,7 @@ TrainVectorBase::ExtractListSamples(std::string parameterName, std::string param
input->PushBack( mv );
if( feature.ogr().IsFieldSet( cFieldIndex ) )
if( feature.ogr().IsFieldSet( cFieldIndex ) && cFieldIndex != -1 )
target->PushBack( feature.ogr().GetFieldAsInteger( cFieldIndex ) );
else
target->PushBack( 0 );
......@@ -259,6 +259,8 @@ TrainVectorBase::ExtractListSamples(std::string parameterName, std::string param
}
}
ShiftScaleFilterType::Pointer shiftScaleFilter = ShiftScaleFilterType::New();
shiftScaleFilter->SetInput( input );
shiftScaleFilter->SetShifts( measurement.meanMeasurementVector );
......
......@@ -935,6 +935,24 @@ if(OTB_USE_OPENCV)
${TEMP}/apTvClTrainVectorClassifierModel.rf)
endif()
#----------- TrainVectorClustering TESTS ----------------
if(OTB_USE_SHARK)
otb_test_application(NAME apTvClTrainVectorClustering
APP TrainVectorClustering
OPTIONS -io.vd ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite
-feat value_0 value_1 value_2 value_3
-classifier sharkkm
-io.out ${TEMP}/apTvClTrainVectorClusteringModel.txt)
otb_test_application(NAME apTvClTrainVectorClusteringWithClass
APP TrainVectorClustering
OPTIONS -io.vd ${INPUTDATA}/Classification/apTvClSampleExtractionOut.sqlite
-feat value_0 value_1 value_2 value_3
-cfield class
-classifier sharkkm
-io.out ${TEMP}/apTvClTrainVectorClusteringModelWithClass.txt)
endif()
#------------ MultiImageSamplingRate TESTS ----------------
otb_test_application(
NAME apTvClMultiImageSamplingRate
......
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