OTB  10.0.0
Orfeo Toolbox
otbTrainDimensionalityReductionApplicationBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 #ifndef otbTrainDimensionalityReductionApplicationBase_h
21 #define otbTrainDimensionalityReductionApplicationBase_h
22 
23 #include "otbConfigure.h"
24 #include "otbWrapperApplication.h"
26 
27 // ListSample
28 #include "itkListSample.h"
29 #include "itkVariableLengthVector.h"
30 
31 
32 namespace otb
33 {
34 namespace Wrapper
35 {
36 
69 template <class TInputValue, class TOutputValue>
71 {
72 public:
76  typedef itk::SmartPointer<Self> Pointer;
77  typedef itk::SmartPointer<const Self> ConstPointer;
78 
80  itkTypeMacro(TrainDimensionalityReductionApplicationBase, otb::Application);
81 
82  typedef TInputValue InputValueType;
83  typedef TOutputValue OutputValueType;
84 
87 
91 
94 
95 protected:
98 
101  void Train(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
102 
104  void Reduce(typename ListSampleType::Pointer validationListSample, std::string modelPath);
105 
107  void DoInit() override;
108 
109 private:
112  void InitSOMParams();
113  template <class somchoice>
114  void TrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
115  void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
116 
117 #ifdef OTB_USE_SHARK
118  void InitAutoencoderParams();
119  void InitPCAParams();
120 
121  void BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
122  template <class autoencoderchoice>
123  void TrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
124 
125  void TrainPCA(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
126 #endif
127 };
128 
129 } // end of namespace Wrapper
130 } // end of namespace otb
131 
132 #ifndef OTB_MANUAL_INSTANTIATION
135 #include <string>
136 
137 #ifdef OTB_USE_SHARK
140 #endif
141 #endif
142 
143 #endif
DimensionalityReductionModelType::Pointer DimensionalityReductionModelTypePointer
MachineLearningModel is the base class for all classifier objects (SVM, KNN, Random Forests,...
itk::Statistics::ListSample< InputSampleType > InputListSampleType
MLMSampleTraits< TInputValue >::SampleType InputSampleType
Creation of an "otb" vector image which contains metadata.
Superclass::PixelType PixelType
This class represent an application TODO.
void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
ModelFactoryType::DimensionalityReductionModelTypePointer ModelPointerType
otb::DimensionalityReductionModelFactory< InputValueType, OutputValueType > ModelFactoryType
void TrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
void Train(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
void Reduce(typename ListSampleType::Pointer validationListSample, std::string modelPath)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.