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
Container Registry
Model registry
Operate
Environments
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
Antoine Belvire
otb
Commits
98e98ec2
Commit
98e98ec2
authored
17 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
Modification de svm : ajout des tests.
parent
a6b48b15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Testing/Utilities/CMakeLists.txt
+12
-0
12 additions, 0 deletions
Testing/Utilities/CMakeLists.txt
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
+28
-11
28 additions, 11 deletions
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
with
40 additions
and
11 deletions
Testing/Utilities/CMakeLists.txt
+
12
−
0
View file @
98e98ec2
...
...
@@ -93,7 +93,19 @@ ADD_TEST(utTvSvmGenericKernelBasicOperationsTest ${UTILITIES_TESTS}
)
ADD_TEST
(
utTvSvmComposedKernelFunctorTest
${
UTILITIES_TESTS
}
--compare-n-ascii
${
TOL
}
3
${
BASELINE_FILES
}
/utTvSVMComposedKernelFunctorResTest.txt
${
TEMP
}
/SVMComposedKernelFunctorTestRes.txt
${
BASELINE_FILES
}
/utTvSVMComposedKernelFunctorTest.txt
${
TEMP
}
/SVMComposedKernelFunctorTestOutputBis.txt
${
BASELINE_FILES
}
/utTvSVMComposedKernelFunctorTest.txt
${
TEMP
}
/SVMComposedKernelFunctorTestOutputBis.txt
otbSVMComposedKernelFunctorTest
${
TEMP
}
/SVMComposedKernelFunctorTestRes.txt
${
TEMP
}
/SVMComposedKernelFunctorTestOutput.txt
${
TEMP
}
/SVMComposedKernelFunctorTestOutputBis.txt
)
# ------- lib otb6S ------------------------------
...
...
This diff is collapsed.
Click to expand it.
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
+
28
−
11
View file @
98e98ec2
...
...
@@ -23,6 +23,7 @@
#include
"itkExceptionObject.h"
#include
"otbImage.h"
#include
<iostream>
#include
<fstream>
#include
"otbSVMModel.h"
#include
"otbSVMKernels.h"
...
...
@@ -114,33 +115,49 @@ int otbSVMComposedKernelFunctorTest( int argc, char* argv[] )
y
[
1
].
value
=
10000
;
double
resAdd
=
0.
;
double
resMul
=
0.
;
double
res1
=
0.
;
double
res2
=
0.
;
std
::
ofstream
file
;
file
.
open
(
argv
[
1
]);
file
<<
"Inputs Values: 10, 5, Inputs Ponderation: 1.5, 2"
<<
std
::
endl
;
file
<<
std
::
endl
;
file
<<
"Functor Results:"
<<
std
::
endl
;
res1
=
customFunctor
(
SVx
[
0
],
SVy
[
0
],
model
->
param
);
std
::
cout
<<
"customFunctor : "
<<
res1
<<
std
::
endl
;
file
<<
"Custom Functor only: "
<<
res1
<<
std
::
endl
;
//std::cout<<"customFunctor : "<<res1<<std::endl;
res2
=
SAMFunctor
(
SVx
[
0
],
SVy
[
0
],
model
->
param
);
std
::
cout
<<
"SAMFunctor : "
<<
res2
<<
std
::
endl
;
file
<<
"SAM Functor only: "
<<
res2
<<
std
::
endl
;
//std::cout<<"SAMFunctor : "<<res2<<std::endl;
file
<<
"Composed Functor: "
<<
std
::
endl
;
resAdd
=
(
*
(
svmModel
->
GetModel
()
->
param
.
kernel_composed
))(
SVx
[
0
],
SVy
[
0
],
svmModel
->
GetModel
()
->
param
);
std
::
cout
<<
"composed : "
<<
resAdd
<<
std
::
endl
;
//
std::cout<<"composed : "<<resAdd<<std::endl;
svmModel
->
GetModel
()
->
param
.
kernel_composed
->
SetMultiplyKernelFunctor
(
true
);
resAdd
=
(
*
(
svmModel
->
GetModel
()
->
param
.
kernel_composed
))(
SVx
[
0
],
SVy
[
0
],
svmModel
->
GetModel
()
->
param
);
resMul
=
(
*
(
svmModel
->
GetModel
()
->
param
.
kernel_composed
))(
SVx
[
0
],
SVy
[
0
],
svmModel
->
GetModel
()
->
param
);
//std::cout<<"composed : "<<resAdd<<std::endl;
file
<<
"Addition: "
<<
resAdd
<<
", "
<<
"Multiplication: "
<<
resMul
<<
std
::
endl
;
std
::
cout
<<
"composed : "
<<
resAdd
<<
std
::
endl
;
file
.
close
()
;
svmModel
->
GetModel
()
->
param
.
kernel_composed
->
print_parameters
();
//
svmModel->GetModel()->param.kernel_composed->print_parameters();
svmModel
->
SaveModel
(
"test.txt"
);
svmModel
->
SaveModel
(
argv
[
2
]
);
ModelType
::
Pointer
svmModelBis
=
ModelType
::
New
();
svmModelBis
->
LoadModel
(
"test.txt"
);
svmModelBis
->
LoadModel
(
argv
[
2
]
);
svmModelBis
->
GetModel
()
->
param
.
kernel_composed
->
print_parameters
();
//
svmModelBis->GetModel()->param.kernel_composed->print_parameters();
svmModelBis
->
SaveModel
(
"testBis.txt"
);
svmModelBis
->
SaveModel
(
argv
[
3
]
);
return
EXIT_SUCCESS
;
...
...
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