diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx index a4b8d72d83a4cfb24a9b8c868c0980b0c6943c0d..01123fcdb78881e3bbc460b08825ac43013595ab 100644 --- a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainAutoencoder.txx @@ -3,6 +3,7 @@ #define cbTrainAutoencoder_txx #include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbAutoencoderModel.h" namespace otb { @@ -106,7 +107,15 @@ void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> ::BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath) -{ +{ + // typedef shark::Autoencoder< shark::TanhNeuron, shark::LinearNeuron> AutoencoderType; + typedef shark::LogisticNeuron NeuronType; + typedef otb::AutoencoderModel<InputValueType, NeuronType> AutoencoderModelType; + /* + // typedef shark::TiedAutoencoder< shark::TanhNeuron, shark::LinearNeuron> TiedAutoencoderType; + typedef shark::TiedAutoencoder< shark::TanhNeuron, shark::TanhNeuron> TiedAutoencoderType; + typedef otb::AutoencoderModel<InputValueType, TiedAutoencoderType> TiedAutoencoderModelType; + */ std::string TiedWeigth = GetParameterString("algorithm.autoencoder.istied"); std::cout << TiedWeigth << std::endl; diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx index 66a87aaade278bb00615545fdd5cd010035214d4..4426e103b2404a84f07b2f201a8f5d0f000a1d5f 100644 --- a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainPCA.txx @@ -3,6 +3,7 @@ #define cbTrainPCA_txx #include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbPCAModel.h" namespace otb { @@ -37,6 +38,7 @@ 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); diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx index e9c22f3c85ca2bb87ef89e57782f2e402cff96fe..b437723066e0ea60cc7aaee6c674de33773503ef 100644 --- a/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx +++ b/Modules/Applications/AppDimensionalityReduction/include/otbDimensionalityReductionTrainSOM.txx @@ -2,6 +2,7 @@ #ifndef cbTrainSOM_txx #define cbTrainSOM_txx #include "otbTrainDimensionalityReductionApplicationBase.h" +#include "otbSOMModel.h" namespace otb { @@ -79,7 +80,16 @@ void TrainDimensionalityReductionApplicationBase<TInputValue,TOutputValue> ::BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath) -{ +{ + //typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 2> Map2DType; + //typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 3> Map3DType; + //typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 4> Map4DType; + //typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 5> Map5DType; + typedef otb::SOMModel<InputValueType, 2> SOM2DModelType; + typedef otb::SOMModel<InputValueType, 3> SOM3DModelType; + typedef otb::SOMModel<InputValueType, 4> SOM4DModelType; + typedef otb::SOMModel<InputValueType, 5> SOM5DModelType; + int SomDim = GetParameterInt("algorithm.som.dim"); std::cout << SomDim << std::endl; diff --git a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h index c14bfd8ca057495d5fb34fb95536cefa8d74e913..0dff279698ae8ae7c4326ef625ca4ce8b38cc79d 100644 --- a/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h +++ b/Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h @@ -14,13 +14,6 @@ //Estimator #include "otbDimensionalityReductionModelFactory.h" -#include "otbSOMModel.h" - -#ifdef OTB_USE_SHARK -#include "otbAutoencoderModel.h" -#include "otbPCAModel.h" -#endif - namespace otb { namespace Wrapper @@ -84,34 +77,6 @@ public: typedef typename ModelType::InputSampleType SampleType; typedef typename ModelType::InputListSampleType ListSampleType; - -// Dimensionality reduction models - -//typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 2> Map2DType; - typedef otb::SOMModel<InputValueType, 2> SOM2DModelType; - -//typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 3> Map3DType; - typedef otb::SOMModel<InputValueType, 3> SOM3DModelType; - -//typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 4> Map4DType; - typedef otb::SOMModel<InputValueType, 4> SOM4DModelType; - -//typedef SOMMap<TInputValue,itk::Statistics::EuclideanDistanceMetric<itk::VariableLengthVector<TInputValue>>, 5> Map5DType; - typedef otb::SOMModel<InputValueType, 5> SOM5DModelType; - - -#ifdef OTB_USE_SHARK - -// typedef shark::Autoencoder< shark::TanhNeuron, shark::LinearNeuron> AutoencoderType; - typedef shark::LogisticNeuron NeuronType; - typedef otb::AutoencoderModel<InputValueType, NeuronType> AutoencoderModelType; -/* - // typedef shark::TiedAutoencoder< shark::TanhNeuron, shark::LinearNeuron> TiedAutoencoderType; - typedef shark::TiedAutoencoder< shark::TanhNeuron, shark::TanhNeuron> TiedAutoencoderType; - typedef otb::AutoencoderModel<InputValueType, TiedAutoencoderType> TiedAutoencoderModelType; - */ - typedef otb::PCAModel<InputValueType> PCAModelType; -#endif protected: TrainDimensionalityReductionApplicationBase(); @@ -148,8 +113,6 @@ void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::st void TrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath); void TrainPCA(typename ListSampleType::Pointer trainingListSample, std::string modelPath); - - #endif //@} };