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
95a61745
Commit
95a61745
authored
13 years ago
by
Aurélien Bricier
Browse files
Options
Downloads
Patches
Plain Diff
ENH: adapted to new DS framework specs
parent
c7f6a840
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Fuzzy/otbStandardDSCostFunction.h
+19
-1
19 additions, 1 deletion
Code/Fuzzy/otbStandardDSCostFunction.h
Code/Fuzzy/otbStandardDSCostFunction.txx
+18
-28
18 additions, 28 deletions
Code/Fuzzy/otbStandardDSCostFunction.txx
with
37 additions
and
29 deletions
Code/Fuzzy/otbStandardDSCostFunction.h
+
19
−
1
View file @
95a61745
...
...
@@ -82,6 +82,12 @@ public:
typedef
FuzzyDescriptorsModelManager
FuzzyDescriptorsModelManagerType
;
typedef
FuzzyDescriptorsModelManager
::
DescriptorListType
DescriptorListType
;
typedef
FuzzyDescriptorsModelManager
::
DescriptorsModelType
DescriptorsModelType
;
typedef
FuzzyDescriptorsModelManager
::
PairType
PairType
;
typedef
Parser
ParserType
;
/** This method returns the value of the cost function corresponding
...
...
@@ -101,12 +107,23 @@ public:
itkSetMacro
(
CriterionFormula
,
std
::
string
);
itkGetConstMacro
(
CriterionFormula
,
std
::
string
);
void
SetDescriptorList
(
DescriptorListType
list
)
{
m_DescriptorList
=
list
;
}
DescriptorListType
GetDescriptorList
()
{
return
m_DescriptorList
;
}
itkSetObjectMacro
(
GTVectorData
,
VectorDataType
);
itkGetConstObjectMacro
(
GTVectorData
,
VectorDataType
);
itkSetObjectMacro
(
NSVectorData
,
VectorDataType
);
itkGetConstObjectMacro
(
NSVectorData
,
VectorDataType
);
LabelSetType
GetBeliefHypothesis
()
{
return
m_BeliefHypothesis
;
...
...
@@ -150,7 +167,8 @@ private:
LabelSetType
m_BeliefHypothesis
;
LabelSetType
m_PlausibilityHypothesis
;
const
unsigned
int
m_NumberOfParameters
;
DescriptorListType
m_DescriptorList
;
};
}
// end namespace otb
...
...
This diff is collapsed.
Click to expand it.
Code/Fuzzy/otbStandardDSCostFunction.txx
+
18
−
28
View file @
95a61745
...
...
@@ -27,18 +27,11 @@ template <class TDSValidationFilter>
StandardDSCostFunction<TDSValidationFilter>
::StandardDSCostFunction() :
m_CriterionFormula("((Belief + Plausibility)/2.)"),
m_Weight(0.5),
m_NumberOfParameters(12)
m_Weight(0.5)
{
m_GTVectorData = VectorDataType::New();
m_NSVectorData = VectorDataType::New();
m_Parser = ParserType::New();
m_BeliefHypothesis.insert("ROADSA");
m_PlausibilityHypothesis.insert("ROADSA");
m_PlausibilityHypothesis.insert("NOBUIL");
m_PlausibilityHypothesis.insert("NONDVI");
}
template <class TDSValidationFilter>
...
...
@@ -46,7 +39,7 @@ unsigned int
StandardDSCostFunction<TDSValidationFilter>
::GetNumberOfParameters() const
{
return m_
NumberOfParameters
;
return m_
DescriptorList.size()*4
;
}
template <class TDSValidationFilter>
...
...
@@ -55,23 +48,24 @@ typename StandardDSCostFunction<TDSValidationFilter>
StandardDSCostFunction<TDSValidationFilter>
::GetValue(const ParametersType & parameters) const
{
if (parameters.size() != m_DescriptorList.size()*4)
{
itkExceptionMacro(<< "Wrong model!" )
}
//Initialize parser
m_Parser->SetExpr(m_CriterionFormula);
//unsigned int nbParam = this->GetNumberOfParameters();
std::vector<double> noNDVI, roadSA, noBuilding;
for (unsigned int i = 0; i < 4; i++)
DescriptorsModelType descModel;
for (unsigned int i = 0; i < m_DescriptorList.size(); i++)
{
noNDVI.push_back(parameters[i]);
}
for (unsigned int i = 0; i < 4; i++)
{
roadSA.push_back(parameters[i + 4]);
}
for (unsigned int i = 0; i < 4; i++)
{
noBuilding.push_back(parameters[i + 8]);
std::vector<double> tmp;
for (unsigned int j = 0; j < 4; j++)
{
tmp.push_back(parameters[4*i+j]);
}
PairType pair( m_DescriptorList[i], tmp);
descModel.push_back(pair);
}
typename DSValidationFilterType::Pointer internalFunctionGT = DSValidationFilterType::New();
...
...
@@ -81,9 +75,7 @@ typename StandardDSCostFunction<TDSValidationFilter>
internalFunctionGT->SetPlausibilityHypothesis(m_PlausibilityHypothesis);
try
{
internalFunctionGT->SetFuzzyModel("NONDVI", noNDVI);
internalFunctionGT->SetFuzzyModel("ROADSA", roadSA);
internalFunctionGT->SetFuzzyModel("NOBUIL", noBuilding);
internalFunctionGT->SetDescriptorModels(descModel);
}
catch (itk::ExceptionObject /*& err*/)
{
...
...
@@ -98,9 +90,7 @@ typename StandardDSCostFunction<TDSValidationFilter>
internalFunctionNS->SetBeliefHypothesis(m_PlausibilityHypothesis);
try
{
internalFunctionNS->SetFuzzyModel("NONDVI", noNDVI);
internalFunctionNS->SetFuzzyModel("ROADSA", roadSA);
internalFunctionNS->SetFuzzyModel("NOBUIL", noBuilding);
internalFunctionNS->SetDescriptorModels(descModel);
}
catch (itk::ExceptionObject &)
{
...
...
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