Skip to content
Snippets Groups Projects
Commit 103906cf authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

ENH: clean the ML factories when application is deleted

parent bd42051b
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,13 @@ public:
typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType;
typedef ClassificationFilterType::ConfidenceImageType ConfidenceImageType;
protected:
~ImageClassifier() ITK_OVERRIDE
{
MachineLearningModelFactoryType::CleanFactories();
}
private:
void DoInit() ITK_OVERRIDE
{
......
......@@ -135,6 +135,8 @@ public:
protected:
LearningApplicationBase();
~LearningApplicationBase() ITK_OVERRIDE;
/** Generic method to train and save the machine learning model. This method
* uses specific train methods depending on the chosen model.*/
void Train(typename ListSampleType::Pointer trainingListSample,
......
......@@ -30,7 +30,14 @@ template <class TInputValue, class TOutputValue>
LearningApplicationBase<TInputValue,TOutputValue>
::LearningApplicationBase() : m_RegressionFlag(false)
{
}
}
template <class TInputValue, class TOutputValue>
LearningApplicationBase<TInputValue,TOutputValue>
::~LearningApplicationBase()
{
ModelFactoryType::CleanFactories();
}
template <class TInputValue, class TOutputValue>
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment