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
Sébastien Peillet
otb
Commits
76cc0d3a
Commit
76cc0d3a
authored
9 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Mantis 1023: try to solve crash, fix memory leak
parent
b3f697f4
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
Modules/Learning/SVMLearning/include/otbSVMModel.h
+16
-8
16 additions, 8 deletions
Modules/Learning/SVMLearning/include/otbSVMModel.h
Modules/Learning/SVMLearning/include/otbSVMModel.txx
+3
-1
3 additions, 1 deletion
Modules/Learning/SVMLearning/include/otbSVMModel.txx
with
19 additions
and
9 deletions
Modules/Learning/SVMLearning/include/otbSVMModel.h
+
16
−
8
View file @
76cc0d3a
...
...
@@ -90,13 +90,15 @@ public:
/** Get the number of classes. */
unsigned
int
GetNumberOfClasses
(
void
)
const
{
return
(
unsigned
int
)
(
m_Model
->
nr_class
);
if
(
m_Model
)
return
(
unsigned
int
)
(
m_Model
->
nr_class
);
return
0
;
}
/** Get the number of hyperplane. */
unsigned
int
GetNumberOfHyperplane
(
void
)
const
{
return
(
unsigned
int
)
(
m_Model
->
nr_class
*
(
m_Model
->
nr_class
-
1
)
/
2
);
if
(
m_Model
)
return
(
unsigned
int
)
(
m_Model
->
nr_class
*
(
m_Model
->
nr_class
-
1
)
/
2
);
return
0
;
}
/** Gets the model */
...
...
@@ -308,18 +310,21 @@ public:
/** Return number of support vectors */
int
GetNumberOfSupportVectors
(
void
)
const
{
return
m_Model
->
l
;
if
(
m_Model
)
return
m_Model
->
l
;
return
0
;
}
/** Return rho values */
double
*
GetRho
(
void
)
const
{
return
m_Model
->
rho
;
if
(
m_Model
)
return
m_Model
->
rho
;
return
NULL
;
}
/** Return the support vectors */
svm_node
**
GetSupportVectors
(
void
)
{
return
m_Model
->
SV
;
if
(
m_Model
)
return
m_Model
->
SV
;
return
NULL
;
}
/** Set the support vectors and changes the l number of support vectors accordind to sv.*/
void
SetSupportVectors
(
svm_node
**
sv
,
int
nbOfSupportVector
);
...
...
@@ -327,7 +332,8 @@ public:
/** Return the alphas values (SV Coef) */
double
**
GetAlpha
(
void
)
{
return
m_Model
->
sv_coef
;
if
(
m_Model
)
return
m_Model
->
sv_coef
;
return
NULL
;
}
/** Set the alphas values (SV Coef) */
void
SetAlpha
(
double
**
alpha
,
int
nbOfSupportVector
);
...
...
@@ -335,13 +341,15 @@ public:
/** Return the labels lists */
int
*
GetLabels
()
{
return
m_Model
->
label
;
if
(
m_Model
)
return
m_Model
->
label
;
return
NULL
;
}
/** Get the number of SV per classes */
int
*
GetNumberOfSVPerClasse
()
{
return
m_Model
->
nSV
;
if
(
m_Model
)
return
m_Model
->
nSV
;
return
NULL
;
}
struct
svm_problem
&
GetProblem
()
...
...
This diff is collapsed.
Click to expand it.
Modules/Learning/SVMLearning/include/otbSVMModel.txx
+
3
−
1
View file @
76cc0d3a
...
...
@@ -62,6 +62,7 @@ void
SVMModel<TValue, TLabel>::Initialize()
{
// Initialize model
/*
if (!m_Model)
{
m_Model = new struct svm_model;
...
...
@@ -77,7 +78,8 @@ SVMModel<TValue, TLabel>::Initialize()
m_ModelUpToDate = false;
}
} */
m_ModelUpToDate = false;
// Intialize problem
m_Problem.l = 0;
...
...
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