OTB  9.0.0
Orfeo Toolbox
otbTrainImagesBase.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 
21 #ifndef otbTrainImagesBase_hxx
22 #define otbTrainImagesBase_hxx
23 
24 #include "otbTrainImagesBase.h"
25 
26 namespace otb
27 {
28 namespace Wrapper
29 {
31 {
32  // Group IO
33  AddParameter(ParameterType_Group, "io", "Input and output data");
34  SetParameterDescription("io", "This group of parameters allows setting input and output data.");
35 
36  AddParameter(ParameterType_InputImageList, "io.il", "Input Image List");
37  SetParameterDescription("io.il", "A list of input images.");
38  AddParameter(ParameterType_InputVectorDataList, "io.vd", "Input Vector Data List");
39  SetParameterDescription("io.vd", "A list of vector data to select the training samples.");
40  MandatoryOn("io.vd");
41 
42  AddParameter(ParameterType_Bool, "cleanup", "Temporary files cleaning");
43  SetParameterDescription("cleanup", "If activated, the application will try to clean all temporary files it created");
44  SetParameterInt("cleanup", 1);
45 }
46 
48 {
49  AddApplication("PolygonClassStatistics", "polystat", "Polygon analysis");
50  AddApplication("MultiImageSamplingRate", "rates", "Sampling rates");
51  AddApplication("SampleSelection", "select", "Sample selection");
52  AddApplication("SampleExtraction", "extraction", "Sample extraction");
53 
54  // Sampling settings
55  AddParameter(ParameterType_Group, "sample", "Training and validation samples parameters");
56  SetParameterDescription("sample", "This group of parameters allows you to set training and validation sample lists parameters.");
57  AddParameter(ParameterType_Int, "sample.mt", "Maximum training sample size per class");
58  SetDefaultParameterInt("sample.mt", 1000);
59  SetParameterDescription("sample.mt",
60  "Maximum size per class (in pixels) of "
61  "the training sample list (default = 1000) (no limit = -1). If equal to -1,"
62  " then the maximal size of the available training sample list per class "
63  "will be equal to the surface area of the smallest class multiplied by the"
64  " training sample ratio.");
65  AddParameter(ParameterType_Int, "sample.mv", "Maximum validation sample size per class");
66  SetDefaultParameterInt("sample.mv", 1000);
67  SetParameterDescription("sample.mv",
68  "Maximum size per class (in pixels) of "
69  "the validation sample list (default = 1000) (no limit = -1). If equal to -1,"
70  " then the maximal size of the available validation sample list per class "
71  "will be equal to the surface area of the smallest class multiplied by the "
72  "validation sample ratio.");
73  AddParameter(ParameterType_Int, "sample.bm", "Bound sample number by minimum");
74  SetDefaultParameterInt("sample.bm", 1);
75  SetParameterDescription("sample.bm",
76  "Bound the number of samples for each "
77  "class by the number of available samples by the smaller class. Proportions "
78  "between training and validation are respected. Default is true (=1).");
79  AddParameter(ParameterType_Float, "sample.vtr", "Training and validation sample ratio");
80  SetParameterDescription("sample.vtr",
81  "Ratio between training and validation samples (0.0 = all training, 1.0 = "
82  "all validation) (default = 0.5).");
83  SetParameterFloat("sample.vtr", 0.5);
84  SetMaximumParameterFloatValue("sample.vtr", 1.0);
85  SetMinimumParameterFloatValue("sample.vtr", 0.0);
86 
87  // AddParameter( ParameterType_Float, "sample.percent", "Percentage of sample extract from images" );
88  // SetParameterDescription( "sample.percent", "Percentage of sample extract from images for "
89  // "training and validation when only images are provided." );
90  // SetDefaultParameterFloat( "sample.percent", 1.0 );
91  // SetMinimumParameterFloatValue( "sample.percent", 0.0 );
92  // SetMaximumParameterFloatValue( "sample.percent", 1.0 );
93 
96 }
97 
99 {
100  // hide sampling parameters
101  // ShareParameter("sample.strategy","rates.strategy");
102  // ShareParameter("sample.mim","rates.mim");
103  ShareParameter("ram", "polystat.ram");
104  ShareParameter("elev", "polystat.elev");
105  ShareParameter("sample.vfn", "polystat.field", "Field containing the class integer label for supervision",
106  "Field containing the class id for supervision. "
107  "The values in this field shall be cast into integers.");
108  SetVectorData("sample.vfn", "io.vd");
109 }
110 
112 {
113  Connect("extraction.field", "polystat.field");
114  Connect("extraction.layer", "polystat.layer");
115 
116  Connect("select.ram", "polystat.ram");
117  Connect("extraction.ram", "polystat.ram");
118 
119  Connect("select.field", "polystat.field");
120  Connect("select.layer", "polystat.layer");
121  Connect("select.elev", "polystat.elev");
122 
123  Connect("extraction.in", "select.in");
124  Connect("extraction.vec", "select.out");
125 }
126 
128 {
129  AddApplication("TrainVectorClassifier", "training", "Model training");
130 
131  AddParameter(ParameterType_InputVectorDataList, "io.valid", "Validation Vector Data List");
132  SetParameterDescription("io.valid", "A list of vector data to select the validation samples.");
133  MandatoryOff("io.valid");
134 
137 };
138 
140 {
141  ShareParameter("io.imstat", "training.io.stats");
142  ShareParameter("io.out", "training.io.out");
143 
144  ShareParameter("classifier", "training.classifier");
145  ShareParameter("rand", "training.rand");
146 
147  ShareParameter("io.confmatout", "training.io.confmatout");
148 }
149 
151 {
152  Connect("select.rand", "training.rand");
153 }
154 
155 void TrainImagesBase::ComputePolygonStatistics(FloatVectorImageListType* imageList, const std::vector<std::string>& vectorFileNames,
156  const std::vector<std::string>& statisticsFileNames)
157 {
158  unsigned int nbImages = static_cast<unsigned int>(imageList->Size());
159  for (unsigned int i = 0; i < nbImages; i++)
160  {
161  GetInternalApplication("polystat")->SetParameterInputImage("in", imageList->GetNthElement(i));
162  GetInternalApplication("polystat")->SetParameterString("vec", vectorFileNames[i]);
163  GetInternalApplication("polystat")->SetParameterString("out", statisticsFileNames[i]);
164  ExecuteInternal("polystat");
165  }
166 }
167 
168 
170 {
171  SamplingRates rates;
172  GetInternalApplication("rates")->SetParameterString("mim", "proportional");
173  double vtr = GetParameterFloat("sample.vtr");
174  long mt = GetParameterInt("sample.mt");
175  long mv = GetParameterInt("sample.mv");
176  // compute final maximum training and final maximum validation
177  // By default take all samples (-1 means all samples)
178  rates.fmt = -1;
179  rates.fmv = -1;
180  if (GetParameterInt("sample.bm") == 0)
181  {
182  if (dedicatedValidation)
183  {
184  // fmt and fmv will be used separately
185  rates.fmt = mt;
186  rates.fmv = mv;
187  if (mt > -1 && mv <= -1 && vtr < 0.99999)
188  {
189  rates.fmv = static_cast<long>((double)mt * vtr / (1.0 - vtr));
190  }
191  if (mt <= -1 && mv > -1 && vtr > 0.00001)
192  {
193  rates.fmt = static_cast<long>((double)mv * (1.0 - vtr) / vtr);
194  }
195  }
196  else
197  {
198  // only fmt will be used for both training and validation samples
199  // So we try to compute the total number of samples given input
200  // parameters mt, mv and vtr.
201  if (mt > -1 && vtr < 0.99999)
202  {
203  rates.fmt = static_cast<long>((double)mt / (1.0 - vtr));
204  }
205  if (mv > -1 && vtr > 0.00001)
206  {
207  if (rates.fmt > -1)
208  {
209  rates.fmt = std::min(rates.fmt, static_cast<long>((double)mv / vtr));
210  }
211  else
212  {
213  rates.fmt = static_cast<long>((double)mv / vtr);
214  }
215  }
216  }
217  }
218  return rates;
219 }
220 
221 
222 void TrainImagesBase::ComputeSamplingRate(const std::vector<std::string>& statisticsFileNames, const std::string& ratesFileName, long maximum)
223 {
224  // Sampling rates
225  GetInternalApplication("rates")->SetParameterStringList("il", statisticsFileNames);
226  GetInternalApplication("rates")->SetParameterString("out", ratesFileName);
227  if (GetParameterInt("sample.bm") != 0)
228  {
229  GetInternalApplication("rates")->SetParameterString("strategy", "smallest");
230  }
231  else
232  {
233  if (maximum > -1)
234  {
235  std::ostringstream oss;
236  oss << maximum;
237  GetInternalApplication("rates")->SetParameterString("strategy", "constant");
238  GetInternalApplication("rates")->SetParameterString("strategy.constant.nb", oss.str());
239  }
240  else
241  {
242  GetInternalApplication("rates")->SetParameterString("strategy", "all");
243  }
244  }
245  ExecuteInternal("rates");
246 }
247 
248 void TrainImagesBase::TrainModel(FloatVectorImageListType* imageList, const std::vector<std::string>& sampleTrainFileNames,
249  const std::vector<std::string>& sampleValidationFileNames)
250 {
251  GetInternalApplication("training")->SetParameterStringList("io.vd", sampleTrainFileNames);
252  if (!sampleValidationFileNames.empty())
253  GetInternalApplication("training")->SetParameterStringList("valid.vd", sampleValidationFileNames);
254 
255  UpdateInternalParameters("training");
256  // set field names
257  FloatVectorImageType::Pointer image = imageList->GetNthElement(0);
258  unsigned int nbBands = image->GetNumberOfComponentsPerPixel();
259  std::vector<std::string> selectedNames;
260  for (unsigned int i = 0; i < nbBands; i++)
261  {
262  std::ostringstream oss;
263  oss << i;
264  selectedNames.push_back("value_" + oss.str());
265  }
266  GetInternalApplication("training")->SetParameterStringList("feat", selectedNames);
267 
268  // cfield is not directly connected to sample.vfn (ListView parameter) because the associated vector
269  // data is not the same (the fields are not the same).
270  GetInternalApplication("training")->SetParameterStringList("cfield",
271  {GetChoiceNames("sample.vfn")[GetSelectedItems("sample.vfn").front()]});
272 
273  ExecuteInternal("training");
274 }
275 
276 void TrainImagesBase::SelectAndExtractSamples(FloatVectorImageType* image, std::string vectorFileName, std::string sampleFileName,
277  std::string statisticsFileName, std::string ratesFileName, SamplingStrategy strategy, std::string selectedField)
278 {
279  GetInternalApplication("select")->SetParameterInputImage("in", image);
280  GetInternalApplication("select")->SetParameterString("out", sampleFileName);
281 
282  // Change the selection strategy based on selected sampling strategy
283  switch (strategy)
284  {
285  // case GEOMETRIC:
286  // GetInternalApplication( "select" )->SetParameterString( "sampler", "random");
287  // GetInternalApplication( "select" )->SetParameterString( "strategy", "percent");
288  // GetInternalApplication( "select" )->SetParameterFloat( "strategy.percent.p",
289  // GetParameterFloat( "sample.percent" ));
290  // break;
291  case CLASS:
292  default:
293  GetInternalApplication("select")->SetParameterString("vec", vectorFileName);
294  GetInternalApplication("select")->SetParameterString("instats", statisticsFileName);
295  GetInternalApplication("select")->SetParameterString("sampler", "periodic");
296  GetInternalApplication("select")->SetParameterInt("sampler.periodic.jitter", 50);
297  GetInternalApplication("select")->SetParameterString("strategy", "byclass");
298  GetInternalApplication("select")->SetParameterString("strategy.byclass.in", ratesFileName);
299  break;
300  }
301 
302  // select sample positions
303  ExecuteInternal("select");
304 
305  GetInternalApplication("extraction")->SetParameterString("vec", sampleFileName);
306  UpdateInternalParameters("extraction");
307  if (!selectedField.empty())
308  GetInternalApplication("extraction")->SetParameterString("field", selectedField);
309 
310  GetInternalApplication("extraction")->SetParameterString("outfield", "prefix");
311  GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_");
312 
313  // extract sample descriptors
314  ExecuteInternal("extraction");
315 }
316 
317 
319  std::vector<std::string> vectorFileNames, SamplingStrategy strategy, std::string selectedFieldName)
320 {
321 
322  for (unsigned int i = 0; i < imageList->Size(); ++i)
323  {
324  std::string vectorFileName = vectorFileNames.empty() ? "" : vectorFileNames[i];
325  SelectAndExtractSamples(imageList->GetNthElement(i), vectorFileName, fileNames.sampleOutputs[i], fileNames.polyStatTrainOutputs[i],
326  fileNames.ratesTrainOutputs[i], strategy, selectedFieldName);
327  }
328 }
329 
330 
332  const std::vector<std::string>& validationVectorFileList)
333 {
334  for (unsigned int i = 0; i < imageList->Size(); ++i)
335  {
336  SelectAndExtractSamples(imageList->GetNthElement(i), validationVectorFileList[i], fileNames.sampleValidOutputs[i], fileNames.polyStatValidOutputs[i],
337  fileNames.ratesValidOutputs[i], Self::CLASS);
338  }
339 }
340 
342 {
343  for (unsigned int i = 0; i < imageList->Size(); ++i)
344  {
345  SplitTrainingAndValidationSamples(imageList->GetNthElement(i), fileNames.sampleOutputs[i], fileNames.sampleTrainOutputs[i], fileNames.sampleValidOutputs[i],
346  fileNames.ratesTrainOutputs[i]);
347  }
348 }
349 
350 void TrainImagesBase::SplitTrainingAndValidationSamples(FloatVectorImageType* image, std::string sampleFileName, std::string sampleTrainFileName,
351  std::string sampleValidFileName, std::string ratesTrainFileName)
352 
353 {
354  // Split between training and validation
358  // read sampling rates from ratesTrainOutputs
360  rateCalculator->Read(ratesTrainFileName);
361  // Compute sampling rates for train and valid
362  const MapRateType& inputRates = rateCalculator->GetRatesByClass();
363  MapRateType trainRates;
364  MapRateType validRates;
366  for (MapRateType::const_iterator it = inputRates.begin(); it != inputRates.end(); ++it)
367  {
368  double vtr = GetParameterFloat("sample.vtr");
369  unsigned long total = std::min(it->second.Required, it->second.Tot);
370  unsigned long neededValid = static_cast<unsigned long>((double)total * vtr);
371  unsigned long neededTrain = total - neededValid;
372  tpt.Tot = total;
373  tpt.Required = neededTrain;
374  tpt.Rate = (1.0 - vtr);
375  trainRates[it->first] = tpt;
376  tpt.Tot = neededValid;
377  tpt.Required = neededValid;
378  tpt.Rate = 1.0;
379  validRates[it->first] = tpt;
380  }
381 
382  // Use an otb::OGRDataToSamplePositionFilter with 2 outputs
384  param.Offset = 0;
385  param.MaxJitter = 0;
387  splitter->SetInput(image);
388  splitter->SetOGRData(source);
389  splitter->SetOutputPositionContainerAndRates(destTrain, trainRates, 0);
390  splitter->SetOutputPositionContainerAndRates(destValid, validRates, 1);
391  splitter->SetFieldName(this->GetParameterStringList("sample.vfn")[0]);
392  splitter->SetLayerIndex(0);
393  splitter->SetOriginFieldName(std::string(""));
394  splitter->SetSamplerParameters(param);
395  splitter->GetStreamer()->SetAutomaticTiledStreaming(static_cast<unsigned int>(this->GetParameterInt("ram")));
396  AddProcess(splitter->GetStreamer(), "Split samples between training and validation...");
397  splitter->Update();
398 }
399 }
400 }
401 
402 #endif
otb::Wrapper::CompositeApplication::ExecuteInternal
void ExecuteInternal(std::string key)
otb::Wrapper::CompositeApplication::Connect
bool Connect(std::string fromKey, std::string toKey)
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::sampleTrainOutputs
std::vector< std::string > sampleTrainOutputs
Definition: otbTrainImagesBase.h:256
otb::Wrapper::Application::SetParameterInputImage
void SetParameterInputImage(std::string const &parameter, ImageBaseType *inputImage)
otb::Wrapper::Application::SetVectorData
void SetVectorData(std::string const &key, std::string const &vectorData)
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler
Definition: otbTrainImagesBase.h:190
otb::Wrapper::ParameterType_InputImageList
@ ParameterType_InputImageList
Definition: otbWrapperTypes.h:49
otb::OGRDataToSamplePositionFilter::New
static Pointer New()
otb::Wrapper::Application::GetSelectedItems
std::vector< int > GetSelectedItems(std::string const &paramKey)
otb::Wrapper::TrainImagesBase::TrainModel
void TrainModel(FloatVectorImageListType *imageList, const std::vector< std::string > &sampleTrainFileNames, const std::vector< std::string > &sampleValidationFileNames)
Definition: otbTrainImagesBase.hxx:248
otb::Wrapper::TrainImagesBase::SamplingRates::fmv
long int fmv
Definition: otbTrainImagesBase.h:181
otb::Wrapper::TrainImagesBase::ShareClassificationParams
void ShareClassificationParams()
Definition: otbTrainImagesBase.hxx:139
otb::Wrapper::Application::AddParameter
void AddParameter(ParameterType type, std::string const &paramKey, std::string const &paramName)
otb::ObjectList::GetNthElement
ObjectPointerType GetNthElement(unsigned int index) const
Definition: otbObjectList.hxx:144
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::sampleOutputs
std::vector< std::string > sampleOutputs
Definition: otbTrainImagesBase.h:255
otb::VectorImage::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorImage.h:53
otb::Wrapper::Application::GetChoiceNames
std::vector< std::string > GetChoiceNames(std::string const &paramKey)
otb::Wrapper::ParameterType_Bool
@ ParameterType_Bool
Definition: otbWrapperTypes.h:60
otb::Wrapper::TrainImagesBase::ComputePolygonStatistics
void ComputePolygonStatistics(FloatVectorImageListType *imageList, const std::vector< std::string > &vectorFileNames, const std::vector< std::string > &statisticsFileNames)
Definition: otbTrainImagesBase.hxx:155
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::sampleValidOutputs
std::vector< std::string > sampleValidOutputs
Definition: otbTrainImagesBase.h:257
otb::Wrapper::TrainImagesBase::InitClassification
void InitClassification()
Definition: otbTrainImagesBase.hxx:127
otb::Wrapper::Application::SetParameterInt
void SetParameterInt(std::string const &parameter, int value, bool hasUserValueFlag=true)
otb::SamplingRateCalculator::New
static Pointer New()
otb::Wrapper::TrainImagesBase::ConnectSamplingParameters
void ConnectSamplingParameters()
Definition: otbTrainImagesBase.hxx:111
otb::OGRDataToSamplePositionFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbOGRDataToSamplePositionFilter.h:183
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Wrapper::Application::SetMinimumParameterFloatValue
void SetMinimumParameterFloatValue(std::string const &parameter, float value)
otb::Wrapper::Application::SetParameterFloat
void SetParameterFloat(std::string const &parameter, float value, bool hasUserValueFlag=true)
otb::Wrapper::Application::GetParameterStringList
std::vector< std::string > GetParameterStringList(const std::string &parameter)
otb::Wrapper::TrainImagesBase::InitIO
void InitIO()
Definition: otbTrainImagesBase.hxx:30
otb::Wrapper::Application::AddProcess
void AddProcess(itk::ProcessObject *object, std::string description)
otb::Wrapper::TrainImagesBase::SelectAndExtractSamples
void SelectAndExtractSamples(FloatVectorImageType *image, std::string vectorFileName, std::string sampleFileName, std::string statisticsFileName, std::string ratesFileName, SamplingStrategy strategy, std::string selectedField="")
Definition: otbTrainImagesBase.hxx:276
otb::Wrapper::CompositeApplication::ShareParameter
bool ShareParameter(std::string localKey, std::string internalKey, std::string name=std::string(), std::string desc=std::string())
otb::Wrapper::CompositeApplication::GetInternalApplication
Application * GetInternalApplication(std::string id)
otb::Wrapper::ParameterType_Group
@ ParameterType_Group
Definition: otbWrapperTypes.h:55
otb::Wrapper::CompositeApplication::UpdateInternalParameters
void UpdateInternalParameters(std::string key)
otb::SamplingRateCalculator::TripletType
struct OTBSampling_EXPORT otb::SamplingRateCalculator::Triplet TripletType
otb::Wrapper::Application::SetDefaultParameterInt
void SetDefaultParameterInt(std::string const &parameter, int value)
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::polyStatTrainOutputs
std::vector< std::string > polyStatTrainOutputs
Definition: otbTrainImagesBase.h:251
otb::Wrapper::ParameterType_Int
@ ParameterType_Int
Definition: otbWrapperTypes.h:38
otb::ObjectList::Size
InternalContainerSizeType Size(void) const override
Definition: otbObjectList.hxx:62
otb::Wrapper::Application::SetParameterDescription
void SetParameterDescription(std::string const &paramKey, std::string dec)
otb::Wrapper::TrainImagesBase::CLASS
@ CLASS
Definition: otbTrainImagesBase.h:65
otb::Wrapper::Application::MandatoryOn
void MandatoryOn(std::string const &paramKey)
otb::ogr::DataSource::Modes::Overwrite
@ Overwrite
Definition: otbOGRDataSourceWrapper.h:127
otb::Wrapper::Application::SetMaximumParameterFloatValue
void SetMaximumParameterFloatValue(std::string const &parameter, float value)
otb::Wrapper::ParameterType_Float
@ ParameterType_Float
Definition: otbWrapperTypes.h:39
otb::Wrapper::Application::SetParameterStringList
void SetParameterStringList(std::string const &parameter, std::vector< std::string > values, bool hasUserValueFlag=true)
otb::Wrapper::TrainImagesBase::SamplingRates
Definition: otbTrainImagesBase.h:178
otb::Wrapper::ParameterType_InputVectorDataList
@ ParameterType_InputVectorDataList
Definition: otbWrapperTypes.h:51
otb::OGRDataToSamplePositionFilter::SamplerParameterType
SamplerType::ParameterType SamplerParameterType
Definition: otbOGRDataToSamplePositionFilter.h:194
otb::Wrapper::Application::SetParameterString
void SetParameterString(std::string const &parameter, std::string value, bool hasUserValueFlag=true)
otb::Wrapper::Application::GetParameterInt
int GetParameterInt(std::string const &parameter) const
otb::SamplingRateCalculator::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSamplingRateCalculator.h:46
otb::ogr::DataSource::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbOGRDataSourceWrapper.h:90
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::ratesTrainOutputs
std::vector< std::string > ratesTrainOutputs
Definition: otbTrainImagesBase.h:253
otb::Wrapper::TrainImagesBase::ComputeFinalMaximumSamplingRates
SamplingRates ComputeFinalMaximumSamplingRates(bool dedicatedValidation)
Definition: otbTrainImagesBase.hxx:169
otb::Wrapper::TrainImagesBase::SamplingRates::fmt
long int fmt
Definition: otbTrainImagesBase.h:180
otb::ogr::DataSource::Modes::Read
@ Read
Open data source in read-only mode.
Definition: otbOGRDataSourceWrapper.h:126
otb::Wrapper::TrainImagesBase::SamplingStrategy
SamplingStrategy
Definition: otbTrainImagesBase.h:65
otb::Wrapper::TrainImagesBase::SplitTrainingAndValidationSamples
void SplitTrainingAndValidationSamples(FloatVectorImageType *image, std::string sampleFileName, std::string sampleTrainFileName, std::string sampleValidFileName, std::string ratesTrainFileName)
Definition: otbTrainImagesBase.hxx:350
otbTrainImagesBase.h
otb::Wrapper::TrainImagesBase::ComputeSamplingRate
void ComputeSamplingRate(const std::vector< std::string > &statisticsFileNames, const std::string &ratesFileName, long maximum)
Definition: otbTrainImagesBase.hxx:222
otb::Wrapper::TrainImagesBase::InitSampling
void InitSampling()
Definition: otbTrainImagesBase.hxx:47
otb::Wrapper::CompositeApplication::AddApplication
bool AddApplication(std::string appType, std::string key, std::string desc)
otb::ObjectList
This class is a generic all-purpose wrapping around an std::vector<itk::SmartPointer<ObjectType> >.
Definition: otbObjectList.h:40
otb::Wrapper::TrainImagesBase::SplitTrainingToValidationSamples
void SplitTrainingToValidationSamples(const TrainFileNamesHandler &fileNames, FloatVectorImageListType *imageList)
Definition: otbTrainImagesBase.hxx:341
otb::Wrapper::Application::MandatoryOff
void MandatoryOff(std::string const &paramKey)
otb::Wrapper::Application::GetParameterFloat
float GetParameterFloat(std::string const &parameter) const
otb::Wrapper::TrainImagesBase::ShareSamplingParameters
void ShareSamplingParameters()
Definition: otbTrainImagesBase.hxx:98
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::polyStatValidOutputs
std::vector< std::string > polyStatValidOutputs
Definition: otbTrainImagesBase.h:252
otb::ogr::DataSource::New
static Pointer New()
otb::Wrapper::TrainImagesBase::SelectAndExtractTrainSamples
void SelectAndExtractTrainSamples(const TrainFileNamesHandler &fileNames, FloatVectorImageListType *imageList, std::vector< std::string > vectorFileNames, SamplingStrategy strategy, std::string selectedFieldName="")
Definition: otbTrainImagesBase.hxx:318
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45
otb::Wrapper::TrainImagesBase::SelectAndExtractValidationSamples
void SelectAndExtractValidationSamples(const TrainFileNamesHandler &fileNames, FloatVectorImageListType *imageList, const std::vector< std::string > &validationVectorFileList=std::vector< std::string >())
Definition: otbTrainImagesBase.hxx:331
otb::Wrapper::TrainImagesBase::ConnectClassificationParams
void ConnectClassificationParams()
Definition: otbTrainImagesBase.hxx:150
otb::Wrapper::TrainImagesBase::TrainFileNamesHandler::ratesValidOutputs
std::vector< std::string > ratesValidOutputs
Definition: otbTrainImagesBase.h:254
otb::Wrapper::TrainImagesBase::MapRateType
otb::SamplingRateCalculator::MapRateType MapRateType
Definition: otbTrainImagesBase.h:62