Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
a52c9b7f
Commit
a52c9b7f
authored
12 years ago
by
Arnaud Jaen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Implement CanRead method for libSVM, SVM and RandomForest factory
parent
c1b68de2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/UtilitiesAdapters/OpenCV/otbMachineLearningModelFactory.txx
+12
-8
12 additions, 8 deletions
...ilitiesAdapters/OpenCV/otbMachineLearningModelFactory.txx
with
12 additions
and
8 deletions
Code/UtilitiesAdapters/OpenCV/otbMachineLearningModelFactory.txx
+
12
−
8
View file @
a52c9b7f
...
...
@@ -21,6 +21,9 @@
//#include "otbKNearestNeighborsMachineLearningModelFactory.h"
#include "otbRandomForestsMachineLearningModelFactory.h"
#include "otbSVMMachineLearningModelFactory.h"
#include "otbLibSVMMachineLearningModelFactory.h"
namespace otb
{
...
...
@@ -33,7 +36,7 @@ MachineLearningModelFactory<TInputValue,TOutputValue>
RegisterBuiltInFactories();
std::list<MachineLearningModelTypePointer> possible
ImageIO
;
std::list<MachineLearningModelTypePointer> possible
MachineLearningModel
;
std::list<LightObject::Pointer> allobjects =
itk::ObjectFactoryBase::CreateAllInstance("otbMachineLearningModel");
for(std::list<LightObject::Pointer>::iterator i = allobjects.begin();
...
...
@@ -42,19 +45,19 @@ MachineLearningModelFactory<TInputValue,TOutputValue>
MachineLearningModel<TInputValue,TOutputValue> * io = dynamic_cast<MachineLearningModel<TInputValue,TOutputValue>*>(i->GetPointer());
if(io)
{
possible
ImageIO
.push_back(io);
possible
MachineLearningModel
.push_back(io);
}
else
{
std::cerr << "Error
ImageIO f
actory did not return an
ImageIOBase
: "
std::cerr << "Error
MachineLearningModel F
actory did not return an
MachineLearningModel
: "
<< (*i)->GetNameOfClass()
<< std::endl;
}
}
for(typename std::list<MachineLearningModelTypePointer>::iterator k = possible
ImageIO
.begin();
k != possible
ImageIO
.end(); ++k)
for(typename std::list<MachineLearningModelTypePointer>::iterator k = possible
MachineLearningModel
.begin();
k != possible
MachineLearningModel
.end(); ++k)
{
if( mode == ReadMode )
if( mode == ReadMode )
{
if((*k)->CanReadFile(path))
{
...
...
@@ -88,9 +91,10 @@ MachineLearningModelFactory<TInputValue,TOutputValue>
if (firstTime)
{
// KNN Format for OTB
// itk::ObjectFactoryBase::RegisterFactory(KNearestNeighborsMachineLearningModelFactory<TInputValue,TOutputValue>::New());
//itk::ObjectFactoryBase::RegisterFactory(KNearestNeighborsMachineLearningModelFactory<TInputValue,TOutputValue>::New());
itk::ObjectFactoryBase::RegisterFactory(RandomForestsMachineLearningModelFactory<TInputValue,TOutputValue>::New());
itk::ObjectFactoryBase::RegisterFactory(LibSVMMachineLearningModelFactory<TInputValue,TOutputValue>::New());
itk::ObjectFactoryBase::RegisterFactory(SVMMachineLearningModelFactory<TInputValue,TOutputValue>::New());
firstTime = false;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment