Request for Changes-78: Refactor TrainImagesClassifier
[Request for Changes - 78] Refactor TrainImagesClassifier
- Author: Guillaume Pasero
- Additional Contributors (if different than authors)
- Submitted on 23.12.16
- Proposed target release : 5.10
- Adopted (+4 from Julien, Victor, Guillaume, Rémi)
- Merged : 434c960a67e3c566c93bcd42faebe524f430412c
This is a refactoring of the TrainImagesClassifier in order to use the new sampling application inside a composite application.
This RFC is part of the new sampling framework (RFComments #20). It will allow the TrainImagesClassifier to make use of the new sampling framework to select samples for training.
Classes and files
M Modules/Filtering/Statistics/include/otbPeriodicSampler.h M Modules/Filtering/Statistics/src/otbPeriodicSampler.cxx M Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.h M Modules/Learning/Sampling/include/otbOGRDataToSamplePositionFilter.txx M Modules/Wrappers/ApplicationEngine/include/otbWrapperCompositeApplication.h M Modules/Wrappers/ApplicationEngine/src/otbWrapperCompositeApplication.cxx
The changes to the periodic sampler are more a fix. The jitter was not stable under multi-threaded execution, so now all the jitter values are computed once, at Reset() time.
otb::OGRDataToSamplePositionFilter, the mechanism that copies the origin FID in the output can be disabled by setting an empty field name (OriginField).
In the CompositeApplication class, a method has been added clean applications during DoInit() (this method may be called more than once). Also, enhancements have been made on the logging, error from internal applications are now properly reported in the composite application.
M Modules/Applications/AppClassification/app/otbSampleSelection.cxx M Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx M Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
In application SampleSelection, the filters doing the sampling are now deleted at the end of DoExecute() so that OGRDataSource used by these filters can be closed at the end of processing.
In TrainVectorClassifier, the class field was not retrieved correctly.
In TrainImagesClassifier :
- the application has been entirely refactored, using the composite application framework (see RFC #70)
- the application keeps the same set of parameters
- internally, it uses the applications PolygonClassStatistics, MultiImageSamplingRate, SampleSelection, SampleExtraction, TrainVectorClassifier.
The only differences are :
- now the application TrainImagesClassifier produces temporary files that are removed by default at the end of processing (see parameter "cleaning".
- the class field name parameter is now a ListViewParameter with a single choice (see RFC #71), so it is necessary to set this parameter.
M Modules/Applications/AppClassification/test/CMakeLists.txt M Modules/Filtering/Statistics/test/otbSamplerTest.cxx
Note on the supported types of class field : most of the applications in the framework support integer and string class field. However, the TrainVectorClassifier application will work only if the values in this field can be cast to integers.