Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
519fbdb8
Commit
519fbdb8
authored
Jan 29, 2017
by
chrizandr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrappers for load methods of EM, LR, SVMSGD and Normal Bayes Classifier
parent
aa5caf83
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
0 deletions
+66
-0
ml.hpp
modules/ml/include/opencv2/ml.hpp
+44
-0
em.cpp
modules/ml/src/em.cpp
+5
-0
lr.cpp
modules/ml/src/lr.cpp
+6
-0
nbayes.cpp
modules/ml/src/nbayes.cpp
+5
-0
svmsgd.cpp
modules/ml/src/svmsgd.cpp
+6
-0
No files found.
modules/ml/include/opencv2/ml.hpp
View file @
519fbdb8
...
...
@@ -393,6 +393,17 @@ public:
/** Creates empty model
Use StatModel::train to train the model after creation. */
CV_WRAP
static
Ptr
<
NormalBayesClassifier
>
create
();
/** @brief Loads and creates a serialized NormalBayesClassifier from a file
*
* Use NormalBayesClassifier::save to serialize and store an NormalBayesClassifier to disk.
* Load the NormalBayesClassifier from this file again, by calling this function with the path to the file.
* Optionally specify the node for the file containing the classifier
*
* @param filepath path to serialized NormalBayesClassifier
* @param nodeName name of node containing the classifier
*/
CV_WRAP
static
Ptr
<
NormalBayesClassifier
>
load
(
const
String
&
filepath
,
const
String
&
nodeName
=
String
());
};
/****************************************************************************************\
...
...
@@ -927,6 +938,17 @@ public:
can use one of the EM::train\* methods or load it from file using Algorithm::load\<EM\>(filename).
*/
CV_WRAP
static
Ptr
<
EM
>
create
();
/** @brief Loads and creates a serialized EM from a file
*
* Use EM::save to serialize and store an EM to disk.
* Load the EM from this file again, by calling this function with the path to the file.
* Optionally specify the node for the file containing the classifier
*
* @param filepath path to serialized EM
* @param nodeName name of node containing the classifier
*/
CV_WRAP
static
Ptr
<
EM
>
load
(
const
String
&
filepath
,
const
String
&
nodeName
=
String
());
};
/****************************************************************************************\
...
...
@@ -1512,6 +1534,17 @@ public:
Creates Logistic Regression model with parameters given.
*/
CV_WRAP
static
Ptr
<
LogisticRegression
>
create
();
/** @brief Loads and creates a serialized LogisticRegression from a file
*
* Use LogisticRegression::save to serialize and store an LogisticRegression to disk.
* Load the LogisticRegression from this file again, by calling this function with the path to the file.
* Optionally specify the node for the file containing the classifier
*
* @param filepath path to serialized LogisticRegression
* @param nodeName name of node containing the classifier
*/
CV_WRAP
static
Ptr
<
LogisticRegression
>
load
(
const
String
&
filepath
,
const
String
&
nodeName
=
String
());
};
...
...
@@ -1627,6 +1660,17 @@ public:
*/
CV_WRAP
static
Ptr
<
SVMSGD
>
create
();
/** @brief Loads and creates a serialized SVMSGD from a file
*
* Use SVMSGD::save to serialize and store an SVMSGD to disk.
* Load the SVMSGD from this file again, by calling this function with the path to the file.
* Optionally specify the node for the file containing the classifier
*
* @param filepath path to serialized SVMSGD
* @param nodeName name of node containing the classifier
*/
CV_WRAP
static
Ptr
<
SVMSGD
>
load
(
const
String
&
filepath
,
const
String
&
nodeName
=
String
());
/** @brief Function sets optimal parameters values for chosen SVM SGD model.
* @param svmsgdType is the type of SVMSGD classifier.
* @param marginType is the type of margin constraint.
...
...
modules/ml/src/em.cpp
View file @
519fbdb8
...
...
@@ -845,6 +845,11 @@ Ptr<EM> EM::create()
return
makePtr
<
EMImpl
>
();
}
Ptr
<
EM
>
EM
::
load
(
const
String
&
filepath
,
const
String
&
nodeName
)
{
return
Algorithm
::
load
<
EM
>
(
filepath
,
nodeName
);
}
}
}
// namespace cv
...
...
modules/ml/src/lr.cpp
View file @
519fbdb8
...
...
@@ -127,6 +127,12 @@ Ptr<LogisticRegression> LogisticRegression::create()
return
makePtr
<
LogisticRegressionImpl
>
();
}
Ptr
<
LogisticRegression
>
LogisticRegression
::
load
(
const
String
&
filepath
,
const
String
&
nodeName
)
{
return
Algorithm
::
load
<
LogisticRegression
>
(
filepath
,
nodeName
);
}
bool
LogisticRegressionImpl
::
train
(
const
Ptr
<
TrainData
>&
trainData
,
int
)
{
// return value
...
...
modules/ml/src/nbayes.cpp
View file @
519fbdb8
...
...
@@ -458,6 +458,11 @@ Ptr<NormalBayesClassifier> NormalBayesClassifier::create()
return
p
;
}
Ptr
<
NormalBayesClassifier
>
NormalBayesClassifier
::
load
(
const
String
&
filepath
,
const
String
&
nodeName
)
{
return
Algorithm
::
load
<
NormalBayesClassifier
>
(
filepath
,
nodeName
);
}
}
}
...
...
modules/ml/src/svmsgd.cpp
View file @
519fbdb8
...
...
@@ -134,6 +134,12 @@ Ptr<SVMSGD> SVMSGD::create()
return
makePtr
<
SVMSGDImpl
>
();
}
Ptr
<
SVMSGD
>
SVMSGD
::
load
(
const
String
&
filepath
,
const
String
&
nodeName
)
{
return
Algorithm
::
load
<
SVMSGD
>
(
filepath
,
nodeName
);
}
void
SVMSGDImpl
::
normalizeSamples
(
Mat
&
samples
,
Mat
&
average
,
float
&
multiplier
)
{
int
featuresCount
=
samples
.
cols
;
...
...
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