Skip to content
Snippets Groups Projects
Commit 47fc69c1 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

BUG : SOMModel now herits from MachineLearningModel<TInput,...> instead of...

BUG : SOMModel now herits from MachineLearningModel<TInput,...> instead of MachineLearningModel<itk:variablelengthvector<TInput>,...>
parent ef7227bd
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,8 @@ private: ...@@ -60,7 +60,8 @@ private:
AddParameter(ParameterType_OutputFilename, "io.out", "Output model"); AddParameter(ParameterType_OutputFilename, "io.out", "Output model");
SetParameterDescription("io.out", "Output file containing the model estimated (.txt format)."); SetParameterDescription("io.out", "Output file containing the model estimated (.txt format).");
AddParameter(ParameterType_InputFilename, "io.stats", "Input XML image statistics file"); AddParameter(ParameterType_InputFilename, "io.stats", "Input XML image statistics file");
MandatoryOff("io.stats"); MandatoryOff("io.stats");
SetParameterDescription("io.stats", "XML file containing mean and variance of each feature."); SetParameterDescription("io.stats", "XML file containing mean and variance of each feature.");
......
...@@ -116,6 +116,11 @@ class CbDimensionalityReductionVector : public Application ...@@ -116,6 +116,11 @@ class CbDimensionalityReductionVector : public Application
SetParameterDescription("pcadim","This optional parameter can be set to reduce the number of eignevectors used in the PCA model file."); // SetParameterDescription("pcadim","This optional parameter can be set to reduce the number of eignevectors used in the PCA model file."); //
MandatoryOff("pcadim"); MandatoryOff("pcadim");
AddParameter(ParameterType_String, "mode", "Writting mode"); //
SetParameterString("mode","overwrite", false);
SetParameterDescription("mode","This parameter determines if the output file is overwritten or updated [overwrite/update]"); //
// Doc example parameter settings // Doc example parameter settings
SetDocExampleParameterValue("in", "vectorData.shp"); SetDocExampleParameterValue("in", "vectorData.shp");
SetDocExampleParameterValue("instat", "meanVar.xml"); SetDocExampleParameterValue("instat", "meanVar.xml");
...@@ -262,7 +267,19 @@ class CbDimensionalityReductionVector : public Application ...@@ -262,7 +267,19 @@ class CbDimensionalityReductionVector : public Application
if (IsParameterEnabled("out") && HasValue("out")) if (IsParameterEnabled("out") && HasValue("out"))
{ {
// Create new OGRDataSource // Create new OGRDataSource
output = ogr::DataSource::New(GetParameterString("out"), ogr::DataSource::Modes::Overwrite); if (GetParameterString("mode")=="overwrite")
{
output = ogr::DataSource::New(GetParameterString("out"), ogr::DataSource::Modes::Overwrite);
}
else if (GetParameterString("mode")=="update")
{
output = ogr::DataSource::New(GetParameterString("out"), ogr::DataSource::Modes::Update_LayerCreateOnly );
}
else
{
otbAppLogFATAL(<< "Error when creating the output file" << GetParameterString("mode") << " : unsupported writting mode type [update/overwrite]");
}
otb::ogr::Layer newLayer = output->CreateLayer(GetParameterString("out"), otb::ogr::Layer newLayer = output->CreateLayer(GetParameterString("out"),
const_cast<OGRSpatialReference*>(layer.GetSpatialRef()), const_cast<OGRSpatialReference*>(layer.GetSpatialRef()),
layer.GetGeomType()); layer.GetGeomType());
......
...@@ -87,16 +87,16 @@ public: ...@@ -87,16 +87,16 @@ public:
// Dimensionality reduction models // Dimensionality reduction models
typedef SOMMap<itk::VariableLengthVector<TInputValue>,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 2> Map2DType; typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 2> Map2DType;
typedef otb::SOMModel<InputValueType, 2> SOM2DModelType; typedef otb::SOMModel<InputValueType, 2> SOM2DModelType;
typedef SOMMap<itk::VariableLengthVector<TInputValue>,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 3> Map3DType; typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 3> Map3DType;
typedef otb::SOMModel<InputValueType, 3> SOM3DModelType; typedef otb::SOMModel<InputValueType, 3> SOM3DModelType;
typedef SOMMap<itk::VariableLengthVector<TInputValue>,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 4> Map4DType; typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 4> Map4DType;
typedef otb::SOMModel<InputValueType, 4> SOM4DModelType; typedef otb::SOMModel<InputValueType, 4> SOM4DModelType;
typedef SOMMap<itk::VariableLengthVector<TInputValue>,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 5> Map5DType; typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 5> Map5DType;
typedef otb::SOMModel<InputValueType, 5> SOM5DModelType; typedef otb::SOMModel<InputValueType, 5> SOM5DModelType;
......
...@@ -45,7 +45,7 @@ cbLearningApplicationBaseDR<TInputValue,TOutputValue> ...@@ -45,7 +45,7 @@ cbLearningApplicationBaseDR<TInputValue,TOutputValue>
AddDocTag(Tags::Learning); AddDocTag(Tags::Learning);
// main choice parameter that will contain all dimensionality reduction options // main choice parameter that will contain all dimensionality reduction options
AddParameter(ParameterType_Choice, "model", "moddel to use for the training"); AddParameter(ParameterType_Choice, "model", "model to use for the training");
SetParameterDescription("model", "Choice of the dimensionality reduction model to use for the training."); SetParameterDescription("model", "Choice of the dimensionality reduction model to use for the training.");
...@@ -83,28 +83,28 @@ cbLearningApplicationBaseDR<TInputValue,TOutputValue> ...@@ -83,28 +83,28 @@ cbLearningApplicationBaseDR<TInputValue,TOutputValue>
if(modelName == "autoencoder") if(modelName == "autoencoder")
{ {
#ifdef OTB_USE_SHARK #ifdef OTB_USE_SHARK
BeforeTrainAutoencoder(trainingListSample,modelPath); BeforeTrainAutoencoder(trainingListSample,modelPath);
#else #else
otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration."); otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration.");
#endif #endif
} }
if(modelName == "tiedautoencoder") if(modelName == "tiedautoencoder")
{ {
#ifdef OTB_USE_SHARK #ifdef OTB_USE_SHARK
TrainAutoencoder<TiedAutoencoderModelType>(trainingListSample,modelPath); TrainAutoencoder<TiedAutoencoderModelType>(trainingListSample,modelPath);
#else #else
otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration."); otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration.");
#endif #endif
} }
if(modelName == "pca") if(modelName == "pca")
{ {
#ifdef OTB_USE_SHARK #ifdef OTB_USE_SHARK
TrainPCA(trainingListSample,modelPath); TrainPCA(trainingListSample,modelPath);
#else #else
otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration."); otbAppLogFATAL("Module SharkLearning is not installed. You should consider turning OTB_USE_SHARK on during cmake configuration.");
#endif #endif
} }
} }
......
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