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: ...@@ -61,6 +61,13 @@ public:
typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType; typedef otb::MachineLearningModelFactory<ValueType, LabelType> MachineLearningModelFactoryType;
typedef ClassificationFilterType::ConfidenceImageType ConfidenceImageType; typedef ClassificationFilterType::ConfidenceImageType ConfidenceImageType;
protected:
~ImageClassifier() ITK_OVERRIDE
{
MachineLearningModelFactoryType::CleanFactories();
}
private: private:
void DoInit() ITK_OVERRIDE void DoInit() ITK_OVERRIDE
{ {
......
...@@ -135,6 +135,8 @@ public: ...@@ -135,6 +135,8 @@ public:
protected: protected:
LearningApplicationBase(); LearningApplicationBase();
~LearningApplicationBase() ITK_OVERRIDE;
/** Generic method to train and save the machine learning model. This method /** Generic method to train and save the machine learning model. This method
* uses specific train methods depending on the chosen model.*/ * uses specific train methods depending on the chosen model.*/
void Train(typename ListSampleType::Pointer trainingListSample, void Train(typename ListSampleType::Pointer trainingListSample,
......
...@@ -30,7 +30,14 @@ template <class TInputValue, class TOutputValue> ...@@ -30,7 +30,14 @@ template <class TInputValue, class TOutputValue>
LearningApplicationBase<TInputValue,TOutputValue> LearningApplicationBase<TInputValue,TOutputValue>
::LearningApplicationBase() : m_RegressionFlag(false) ::LearningApplicationBase() : m_RegressionFlag(false)
{ {
} }
template <class TInputValue, class TOutputValue>
LearningApplicationBase<TInputValue,TOutputValue>
::~LearningApplicationBase()
{
ModelFactoryType::CleanFactories();
}
template <class TInputValue, class TOutputValue> template <class TInputValue, class TOutputValue>
void 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