Commit e2b456e4 authored by Manuel Grizonnet's avatar Manuel Grizonnet

Merge branch 'develop' into review_otb_app_recipes

parents 9097c16b 3b12c544
......@@ -97,25 +97,43 @@ if(SHARK_CONFIG_FILE)
"${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH}")
endif()
set(SHARK_USE_OPENMP_matched)
#define SHARK_USE_OPENMP
# Check if Shark was built with OpenMP, CBLAS, DYNLIB, ...
file(STRINGS "${SHARK_INCLUDE_DIR}/shark/Core/Shark.h" SHARK_H_CONTENTS)
string(REGEX MATCH
"#define.SHARK_USE_OPENMP"
SHARK_USE_OPENMP_matched "${SHARK_H_CONTENTS}")
if(SHARK_USE_OPENMP_matched)
if(NOT OTB_USE_OPENMP)
message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.")
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_OPENMP")
set(SHARK_USE_OPENMP 1)
else()
set(SHARK_USE_OPENMP 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_CBLAS")
set(SHARK_USE_CBLAS 1)
else()
set(SHARK_USE_CBLAS 0)
endif()
if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_DYNLIB")
set(SHARK_USE_DYNLIB 1)
else()
set(SHARK_USE_DYNLIB 0)
endif()
if(SHARK_USE_CBLAS AND SHARK_USE_DYNLIB)
set(REQUIRED_CBLAS_LIB CBLAS_LIBRARY)
find_library(CBLAS_LIBRARY NAMES cblas)
else()
set(REQUIRED_CBLAS_LIB)
endif()
INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Shark
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR
REQUIRED_VARS SHARK_LIBRARY SHARK_INCLUDE_DIR ${REQUIRED_CBLAS_LIB}
VERSION_VAR SHARK_VERSION_STRING)
if(SHARK_FOUND)
set(SHARK_INCLUDE_DIRS ${SHARK_INCLUDE_DIR} ${Boost_INCLUDE_DIR} )
set(SHARK_LIBRARIES ${SHARK_LIBRARY} ${Boost_LIBRARIES} )
if(REQUIRED_CBLAS_LIB)
set(SHARK_LIBRARIES ${SHARK_LIBRARIES} ${CBLAS_LIBRARY})
endif()
endif()
......@@ -56,7 +56,16 @@ application, changing the algorithm at each iteration.
# This will execute the application and save the output to argv[2]
app.ExecuteAndWriteOutput()
NumPy array processing
If you want to handle the parameters from a Python dictionary, you can use the
functions *SetParameters()* and *GetParameters()*.
.. code-block:: python
params = {"in":"myInput.tif", "type.mean.radius":4}
app.SetParameters(params)
params2 = app.GetParameters()
Numpy array processing
----------------------
Input and output images to any OTB application in the form of NumPy array is now possible in OTB Python wrapping.
......
......@@ -22,3 +22,22 @@ otb_create_application(
NAME DimensionalityReduction
SOURCES otbDimensionalityReduction.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES})
OTB_CREATE_APPLICATION(
NAME TrainDimensionalityReduction
SOURCES otbTrainDimensionalityReduction.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES}
)
OTB_CREATE_APPLICATION(
NAME ImageDimensionalityReduction
SOURCES otbImageDimensionalityReduction.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES}
)
OTB_CREATE_APPLICATION(
NAME VectorDimensionalityReduction
SOURCES otbVectorDimensionalityReduction.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES}
)
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"
#include "otbOGRDataSourceWrapper.h"
#include "otbOGRFeatureWrapper.h"
#include "itkVariableLengthVector.h"
#include "otbShiftScaleSampleListFilter.h"
#include "otbStatisticsXMLFileReader.h"
#include <fstream> // write the model file
#include "otbDimensionalityReductionModelFactory.h"
#include "otbTrainDimensionalityReductionApplicationBase.h"
namespace otb
{
namespace Wrapper
{
/**
* \class TrainDimensionalityReduction
*
* Training of a dimensionality reduction model
*/
class TrainDimensionalityReduction : public TrainDimensionalityReductionApplicationBase<float,float>
{
public:
typedef TrainDimensionalityReduction Self;
typedef TrainDimensionalityReductionApplicationBase<float, float> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
itkNewMacro(Self);
itkTypeMacro(TrainDimensionalityReduction, otb::Application);
typedef Superclass::SampleType SampleType;
typedef Superclass::ListSampleType ListSampleType;
typedef Superclass::SampleImageType SampleImageType;
typedef float ValueType;
typedef itk::VariableLengthVector<ValueType> MeasurementType;
typedef otb::StatisticsXMLFileReader<SampleType> StatisticsReader;
typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType;
typedef otb::DimensionalityReductionModelFactory<ValueType, ValueType> ModelFactoryType;
private:
void DoInit()
{
SetName("TrainDimensionalityReduction");
SetDescription("Train a dimensionality reduction model");
SetDocName("Train Dimensionality Reduction");
SetDocLongDescription("Trainer for dimensionality reduction algorithms "
"(autoencoders, PCA, SOM). All input samples are used to compute the "
"model, like other machine learning models.\n"
"The model can be used in the ImageDimensionalityReduction and "
"VectorDimensionalityReduction applications.");
SetDocLimitations("None");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("ImageDimensionalityReduction, VectorDimensionalityReduction");
AddParameter(ParameterType_Group, "io", "Input and output data");
SetParameterDescription("io", "This group of parameters allows setting input and output data.");
AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector Data");
SetParameterDescription("io.vd", "Input geometries used for training (note "
": all geometries from the layer will be used)");
AddParameter(ParameterType_OutputFilename, "io.out", "Output model");
SetParameterDescription("io.out", "Output file containing the estimated model (.txt format).");
AddParameter(ParameterType_InputFilename, "io.stats", "Input XML image statistics file");
MandatoryOff("io.stats");
SetParameterDescription("io.stats", "XML file containing mean and variance of each feature.");
AddParameter(ParameterType_StringList, "feat", "Field names to be used for training."); //
SetParameterDescription("feat","List of field names in the input vector data"
" used as features for training."); //
Superclass::DoInit();
AddRAMParameter();
// Doc example parameter settings
SetDocExampleParameterValue("io.vd", "cuprite_samples.sqlite");
SetDocExampleParameterValue("io.out", "mode.ae");
SetDocExampleParameterValue("algorithm", "pca");
SetDocExampleParameterValue("algorithm.pca.dim", "8");
SetDocExampleParameterValue("feat","value_0 value_1 value_2 value_3 value_4"
" value_5 value_6 value_7 value_8 value_9");
}
void DoUpdateParameters()
{
}
void DoExecute()
{
std::string shapefile = GetParameterString("io.vd");
otb::ogr::DataSource::Pointer source =
otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Read);
otb::ogr::Layer layer = source->GetLayer(0);
ListSampleType::Pointer input = ListSampleType::New();
const int nbFeatures = GetParameterStringList("feat").size();
input->SetMeasurementVectorSize(nbFeatures);
otb::ogr::Layer::const_iterator it = layer.cbegin();
otb::ogr::Layer::const_iterator itEnd = layer.cend();
for( ; it!=itEnd ; ++it)
{
MeasurementType mv;
mv.SetSize(nbFeatures);
for(int idx=0; idx < nbFeatures; ++idx)
{
mv[idx] = (*it)[GetParameterStringList("feat")[idx]].GetValue<double>();
}
input->PushBack(mv);
}
MeasurementType meanMeasurementVector;
MeasurementType stddevMeasurementVector;
if (HasValue("io.stats") && IsParameterEnabled("io.stats"))
{
StatisticsReader::Pointer statisticsReader = StatisticsReader::New();
std::string XMLfile = GetParameterString("io.stats");
statisticsReader->SetFileName(XMLfile);
meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean");
stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev");
}
else
{
meanMeasurementVector.SetSize(nbFeatures);
meanMeasurementVector.Fill(0.);
stddevMeasurementVector.SetSize(nbFeatures);
stddevMeasurementVector.Fill(1.);
}
ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New();
trainingShiftScaleFilter->SetInput(input);
trainingShiftScaleFilter->SetShifts(meanMeasurementVector);
trainingShiftScaleFilter->SetScales(stddevMeasurementVector);
trainingShiftScaleFilter->Update();
ListSampleType::Pointer trainingListSample= trainingShiftScaleFilter->GetOutput();
this->Train(trainingListSample,GetParameterString("io.out"));
}
};
} // end of namespace Wrapper
} // end of namespace otb
OTB_APPLICATION_EXPORT(otb::Wrapper::TrainDimensionalityReduction)
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbDimensionalityReductionTrainAutoencoder_txx
#define otbDimensionalityReductionTrainAutoencoder_txx
#include "otbTrainDimensionalityReductionApplicationBase.h"
#include "otbAutoencoderModel.h"
namespace otb
{
namespace Wrapper
{
template <class TInputValue, class TOutputValue>
void
TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::InitAutoencoderParams()
{
AddChoice("algorithm.autoencoder", "Shark Autoencoder");
SetParameterDescription("algorithm.autoencoder",
"This group of parameters allows setting Shark autoencoder parameters. "
);
//Number Of Iterations
AddParameter(ParameterType_Int, "algorithm.autoencoder.nbiter",
"Maximum number of iterations during training");
SetParameterInt("algorithm.autoencoder.nbiter",100, false);
SetParameterDescription(
"algorithm.autoencoder.nbiter",
"The maximum number of iterations used during training.");
AddParameter(ParameterType_Int, "algorithm.autoencoder.nbiterfinetuning",
"Maximum number of iterations during training");
SetParameterInt("algorithm.autoencoder.nbiterfinetuning",0, false);
SetParameterDescription(
"algorithm.autoencoder.nbiterfinetuning",
"The maximum number of iterations used during fine tuning of the whole network.");
AddParameter(ParameterType_Float, "algorithm.autoencoder.epsilon",
"Epsilon");
SetParameterFloat("algorithm.autoencoder.epsilon",0, false);
SetParameterDescription(
"algorithm.autoencoder.epsilon",
"Epsilon");
AddParameter(ParameterType_Float, "algorithm.autoencoder.initfactor",
"Weight initialization factor");
SetParameterFloat("algorithm.autoencoder.initfactor",1, false);
SetParameterDescription(
"algorithm.autoencoder.initfactor", "Parameter that control the weight initialization of the autoencoder");
//Number Of Hidden Neurons
AddParameter(ParameterType_StringList, "algorithm.autoencoder.nbneuron", "Size");
SetParameterDescription(
"algorithm.autoencoder.nbneuron",
"The number of neurons in each hidden layer.");
//Regularization
AddParameter(ParameterType_StringList, "algorithm.autoencoder.regularization", "Strength of the regularization");
SetParameterDescription("algorithm.autoencoder.regularization",
"Strength of the L2 regularization used during training");
//Noise strength
AddParameter(ParameterType_StringList, "algorithm.autoencoder.noise", "Strength of the noise");
SetParameterDescription("algorithm.autoencoder.noise",
"Strength of the noise");
// Sparsity parameter
AddParameter(ParameterType_StringList, "algorithm.autoencoder.rho", "Sparsity parameter");
SetParameterDescription("algorithm.autoencoder.rho",
"Sparsity parameter");
// Sparsity regularization strength
AddParameter(ParameterType_StringList, "algorithm.autoencoder.beta", "Sparsity regularization strength");
SetParameterDescription("algorithm.autoencoder.beta",
"Sparsity regularization strength");
AddParameter(ParameterType_OutputFilename, "algorithm.autoencoder.learningcurve", "Learning curve");
SetParameterDescription("algorithm.autoencoder.learningcurve", "Learning error values");
MandatoryOff("algorithm.autoencoder.learningcurve");
}
template <class TInputValue, class TOutputValue>
void
TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample,
std::string modelPath)
{
typedef shark::LogisticNeuron NeuronType;
typedef otb::AutoencoderModel<InputValueType, NeuronType> AutoencoderModelType;
TrainAutoencoder<AutoencoderModelType>(trainingListSample,modelPath);
}
template <class TInputValue, class TOutputValue>
template <typename autoencoderchoice>
void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>::TrainAutoencoder(typename ListSampleType::Pointer trainingListSample,std::string modelPath)
{
typename autoencoderchoice::Pointer dimredTrainer = autoencoderchoice::New();
itk::Array<unsigned int> nb_neuron;
itk::Array<float> noise;
itk::Array<float> regularization;
itk::Array<float> rho;
itk::Array<float> beta;
std::vector<std::basic_string<char>> s_nbneuron= GetParameterStringList("algorithm.autoencoder.nbneuron");
std::vector<std::basic_string<char>> s_noise= GetParameterStringList("algorithm.autoencoder.noise");
std::vector<std::basic_string<char>> s_regularization= GetParameterStringList("algorithm.autoencoder.regularization");
std::vector<std::basic_string<char>> s_rho= GetParameterStringList("algorithm.autoencoder.rho");
std::vector<std::basic_string<char>> s_beta= GetParameterStringList("algorithm.autoencoder.beta");
nb_neuron.SetSize(s_nbneuron.size());
noise.SetSize(s_nbneuron.size());
regularization.SetSize(s_nbneuron.size());
rho.SetSize(s_nbneuron.size());
beta.SetSize(s_nbneuron.size());
for (unsigned int i=0; i<s_nbneuron.size(); i++)
{
nb_neuron[i]=std::stoi(s_nbneuron[i]);
noise[i]=std::stof(s_noise[i]);
regularization[i]=std::stof(s_regularization[i]);
rho[i]=std::stof(s_rho[i]);
beta[i]=std::stof(s_beta[i]);
}
dimredTrainer->SetNumberOfHiddenNeurons(nb_neuron);
dimredTrainer->SetNumberOfIterations(GetParameterInt("algorithm.autoencoder.nbiter"));
dimredTrainer->SetNumberOfIterationsFineTuning(GetParameterInt("algorithm.autoencoder.nbiterfinetuning"));
dimredTrainer->SetEpsilon(GetParameterFloat("algorithm.autoencoder.epsilon"));
dimredTrainer->SetInitFactor(GetParameterFloat("algorithm.autoencoder.initfactor"));
dimredTrainer->SetRegularization(regularization);
dimredTrainer->SetNoise(noise);
dimredTrainer->SetRho(rho);
dimredTrainer->SetBeta(beta);
dimredTrainer->SetWriteWeights(true);
if (HasValue("algorithm.autoencoder.learningcurve") &&
IsParameterEnabled("algorithm.autoencoder.learningcurve"))
{
dimredTrainer->SetWriteLearningCurve(true);
dimredTrainer->SetLearningCurveFileName(GetParameterString("algorithm.autoencoder.learningcurve"));
}
dimredTrainer->SetInputListSample(trainingListSample);
dimredTrainer->Train();
dimredTrainer->Save(modelPath);
}
} //end namespace wrapper
} //end namespace otb
#endif
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbDimensionalityReductionTrainPCA_txx
#define otbDimensionalityReductionTrainPCA_txx
#include "otbTrainDimensionalityReductionApplicationBase.h"
#include "otbPCAModel.h"
namespace otb
{
namespace Wrapper
{
template <class TInputValue, class TOutputValue>
void
TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::InitPCAParams()
{
AddChoice("algorithm.pca", "Shark PCA");
SetParameterDescription("algorithm.pca",
"This group of parameters allows setting Shark PCA parameters. "
);
//Output Dimension
AddParameter(ParameterType_Int, "algorithm.pca.dim",
"Dimension of the output of the pca transformation");
SetParameterInt("algorithm.pca.dim",10, false);
SetParameterDescription(
"algorithm.pca.dim",
"Dimension of the output of the pca transformation.");
}
template <class TInputValue, class TOutputValue>
void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::TrainPCA(typename ListSampleType::Pointer trainingListSample,std::string modelPath)
{
typedef otb::PCAModel<InputValueType> PCAModelType;
typename PCAModelType::Pointer dimredTrainer = PCAModelType::New();
dimredTrainer->SetDimension(GetParameterInt("algorithm.pca.dim"));
dimredTrainer->SetInputListSample(trainingListSample);
dimredTrainer->SetWriteEigenvectors(true);
dimredTrainer->Train();
dimredTrainer->Save(modelPath);
}
} //end namespace wrapper
} //end namespace otb
#endif
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbDimensionalityReductionTrainSOM_txx
#define otbDimensionalityReductionTrainSOM_txx
#include "otbTrainDimensionalityReductionApplicationBase.h"
#include "otbSOMModel.h"
namespace otb
{
namespace Wrapper
{
template <class TInputValue, class TOutputValue>
void
TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::InitSOMParams()
{
AddChoice("algorithm.som", "OTB SOM");
SetParameterDescription("algorithm.som",
"This group of parameters allows setting SOM parameters. ");
AddParameter(ParameterType_StringList , "algorithm.som.s", "Map size");
SetParameterDescription("algorithm.som.s", "Sizes of the SOM map (one per "
"dimension). For instance, [12;15] means a 2D map of size 12x15. Support"
"2D to 5D maps.");
MandatoryOff("algorithm.som.s");
AddParameter(ParameterType_StringList , "algorithm.som.n", "Neighborhood sizes");
SetParameterDescription("algorithm.som.n", "Sizes of the initial neighborhood "
"in the SOM map (one per dimension). The number of sizes should be the same"
" as the map sizes");
MandatoryOff("algorithm.som.n");
AddParameter(ParameterType_Int, "algorithm.som.ni", "NumberIteration");
SetParameterDescription("algorithm.som.ni", "Number of iterations for SOM learning");
MandatoryOff("algorithm.som.ni");
AddParameter(ParameterType_Float, "algorithm.som.bi", "BetaInit");
SetParameterDescription("algorithm.som.bi", "Initial learning coefficient");
MandatoryOff("algorithm.som.bi");
AddParameter(ParameterType_Float, "algorithm.som.bf", "BetaFinal");
SetParameterDescription("algorithm.som.bf", "Final learning coefficient");
MandatoryOff("algorithm.som.bf");
AddParameter(ParameterType_Float, "algorithm.som.iv", "InitialValue");
SetParameterDescription("algorithm.som.iv", "Maximum initial neuron weight");
MandatoryOff("algorithm.som.iv");
std::vector<std::string> size(2, std::string("10"));
std::vector<std::string> radius(2, std::string("3"));
SetParameterStringList("algorithm.som.s", size, false);
SetParameterStringList("algorithm.som.n", radius, false);
DisableParameter("algorithm.som.s");
DisableParameter("algorithm.som.n");
SetDefaultParameterInt("algorithm.som.ni", 5);
SetDefaultParameterFloat("algorithm.som.bi", 1.0);
SetDefaultParameterFloat("algorithm.som.bf", 0.1);
SetDefaultParameterFloat("algorithm.som.iv", 10.0);
}
template <class TInputValue, class TOutputValue>
void
TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue>
::BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample,
std::string modelPath)
{
std::vector<std::string> s = GetParameterStringList("algorithm.som.s");
int SomDim = s.size();
if(SomDim == 2)
{
typedef otb::SOMModel<InputValueType, 2> SOM2DModelType;
TrainSOM<SOM2DModelType >(trainingListSample,modelPath);
}
if(SomDim == 3)
{
typedef otb::SOMModel<InputValueType, 3> SOM3DModelType;
TrainSOM<SOM3DModelType >(trainingListSample,modelPath);
}
if(SomDim == 4)
{
typedef otb::SOMModel<InputValueType, 4> SOM4DModelType;
TrainSOM<SOM4DModelType >(trainingListSample,modelPath);
}
if(SomDim == 5)