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
c428fd26
Commit
c428fd26
authored
14 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
WRG
parent
17fcf0f0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx
+18
-19
18 additions, 19 deletions
Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx
with
18 additions
and
19 deletions
Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx
+
18
−
19
View file @
c428fd26
...
@@ -48,8 +48,8 @@ int otbConfusionMatrixCalculatorSetListSamples(int argc, char* argv[])
...
@@ -48,8 +48,8 @@ int otbConfusionMatrixCalculatorSetListSamples(int argc, char* argv[])
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
unsigned
int
nbSamples
=
atoi
(
argv
[
1
]);
int
nbSamples
=
atoi
(
argv
[
1
]);
unsigned
int
nbClasses
=
atoi
(
argv
[
2
]);
int
nbClasses
=
atoi
(
argv
[
2
]);
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
...
@@ -82,8 +82,8 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
...
@@ -82,8 +82,8 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
unsigned
int
nbSamples
=
atoi
(
argv
[
1
]);
int
nbSamples
=
atoi
(
argv
[
1
]);
unsigned
int
nbClasses
=
atoi
(
argv
[
2
]);
int
nbClasses
=
atoi
(
argv
[
2
]);
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
{
{
...
@@ -97,10 +97,11 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
...
@@ -97,10 +97,11 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
calculator
->
SetReferenceLabels
(
refLabels
);
calculator
->
SetReferenceLabels
(
refLabels
);
calculator
->
SetProducedLabels
(
prodLabels
);
calculator
->
SetProducedLabels
(
prodLabels
);
try
{
try
calculator
->
Update
();
{
}
calculator
->
Update
();
catch
(
itk
::
ExceptionObject
)
}
catch
(
itk
::
ExceptionObject
)
{
{
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
...
@@ -126,8 +127,8 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
...
@@ -126,8 +127,8 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
refLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
ListLabelType
::
Pointer
prodLabels
=
ListLabelType
::
New
();
unsigned
int
nbSamples
=
atoi
(
argv
[
1
]);
int
nbSamples
=
atoi
(
argv
[
1
]);
unsigned
int
nbClasses
=
atoi
(
argv
[
2
]);
int
nbClasses
=
atoi
(
argv
[
2
]);
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
for
(
int
i
=
0
;
i
<
nbSamples
;
i
++
)
...
@@ -153,15 +154,13 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
...
@@ -153,15 +154,13 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
double
totalError
=
0.0
;
double
totalError
=
0.0
;
for
(
int
i
=
0
;
i
<
nbClasses
;
i
++
)
for
(
int
i
=
0
;
i
<
nbClasses
;
i
++
)
for
(
int
j
=
0
;
j
<
nbClasses
;
j
++
)
for
(
int
j
=
0
;
j
<
nbClasses
;
j
++
)
{
{
double
goodValue
=
0.0
;
double
goodValue
=
0.0
;
if
(
i
==
j
)
if
(
i
==
j
)
goodValue
=
nbSamples
/
nbClasses
;
goodValue
=
nbSamples
/
nbClasses
;
if
(
confmat
(
i
,
j
)
!=
goodValue
)
totalError
+=
confmat
(
i
,
j
);
if
(
confmat
(
i
,
j
)
!=
goodValue
)
}
totalError
+=
confmat
(
i
,
j
);
}
if
(
totalError
>
0.001
)
if
(
totalError
>
0.001
)
{
{
...
...
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