OTB  6.7.0
Orfeo Toolbox
otbTrainDimensionalityReductionApplicationBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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"
30 
31 
32 namespace otb
33 {
34 namespace Wrapper
35 {
36 
69 template <class TInputValue, class TOutputValue>
71 {
72 public:
78 
80  itkTypeMacro(TrainDimensionalityReductionApplicationBase, otb::Application);
81 
82  typedef TInputValue InputValueType;
83  typedef TOutputValue OutputValueType;
84 
87 
92 
95 
96 protected:
99 
102  void Train(typename ListSampleType::Pointer trainingListSample,
103  std::string modelPath);
104 
106  void Reduce(typename ListSampleType::Pointer validationListSample,
107  std::string modelPath);
108 
110  void DoInit() override;
111 
112 private:
113 
116  void InitSOMParams();
117  template <class somchoice>
118  void TrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
119  void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
120 
121 #ifdef OTB_USE_SHARK
122  void InitAutoencoderParams();
123  void InitPCAParams();
124 
125  void BeforeTrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
126  template <class autoencoderchoice>
127  void TrainAutoencoder(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
128 
129  void TrainPCA(typename ListSampleType::Pointer trainingListSample, std::string modelPath);
130 #endif
131 };
132 
133 } // end of namespace Wrapper
134 } // end of namespace otb
135 
136 #ifndef OTB_MANUAL_INSTANTIATION
139 #include <string>
140 
141 #ifdef OTB_USE_SHARK
144 #endif
145 #endif
146 
147 #endif
Creation of an "otb" vector image which contains metadata.
void Train(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
otb::DimensionalityReductionModelFactory< InputValueType, OutputValueType > ModelFactoryType
MachineLearningModel is the base class for all classifier objects (SVM, KNN, Random Forests...
void TrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
void Reduce(typename ListSampleType::Pointer validationListSample, std::string modelPath)
ModelFactoryType::DimensionalityReductionModelTypePointer ModelPointerType
void BeforeTrainSOM(typename ListSampleType::Pointer trainingListSample, std::string modelPath)
This class represent an application TODO.
MLMSampleTraits< TInputValue >::SampleType InputSampleType