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
76cc0d3a
Commit
76cc0d3a
authored
Apr 21, 2015
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: Mantis 1023: try to solve crash, fix memory leak
parent
b3f697f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
Modules/Learning/SVMLearning/include/otbSVMModel.h
Modules/Learning/SVMLearning/include/otbSVMModel.h
+16
-8
Modules/Learning/SVMLearning/include/otbSVMModel.txx
Modules/Learning/SVMLearning/include/otbSVMModel.txx
+3
-1
No files found.
Modules/Learning/SVMLearning/include/otbSVMModel.h
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
()
...
...
Modules/Learning/SVMLearning/include/otbSVMModel.txx
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;
...
...
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