Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
98e98ec2
Commit
98e98ec2
authored
Feb 25, 2008
by
Cyrille Valladeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modification de svm : ajout des tests.
parent
a6b48b15
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
11 deletions
+40
-11
Testing/Utilities/CMakeLists.txt
Testing/Utilities/CMakeLists.txt
+12
-0
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
+28
-11
No files found.
Testing/Utilities/CMakeLists.txt
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 ------------------------------
...
...
Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment