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
dd8de0c4
Commit
dd8de0c4
authored
Jan 09, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move soft cascade octave to ml module
parent
a0e93d04
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
69 deletions
+77
-69
octave.hpp
apps/sft/include/sft/octave.hpp
+8
-65
octave.cpp
apps/sft/octave.cpp
+0
-0
sft.cpp
apps/sft/sft.cpp
+3
-3
ml.hpp
modules/ml/include/opencv2/ml/ml.hpp
+66
-1
octave.cpp
modules/ml/src/octave.cpp
+0
-0
No files found.
apps/sft/include/sft/octave.hpp
View file @
dd8de0c4
...
...
@@ -155,6 +155,9 @@ private:
void
write
(
cv
::
FileStorage
&
fs
,
const
std
::
string
&
,
const
ICF
&
f
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ICF
&
m
);
using
cv
::
FeaturePool
;
using
cv
::
Dataset
;
class
ICFFeaturePool
:
public
cv
::
FeaturePool
{
public
:
...
...
@@ -184,79 +187,20 @@ private:
};
using
cv
::
FeaturePool
;
class
Dataset
class
ScaledDataset
:
public
Dataset
{
public
:
typedef
enum
{
POSITIVE
=
1
,
NEGATIVE
=
2
}
SampleType
;
Dataset
(
const
sft
::
string
&
path
,
const
int
octave
);
ScaledDataset
(
const
sft
::
string
&
path
,
const
int
octave
);
cv
::
Mat
get
(
SampleType
type
,
int
idx
)
const
;
int
available
(
SampleType
type
)
const
;
virtual
cv
::
Mat
get
(
SampleType
type
,
int
idx
)
const
;
virtual
int
available
(
SampleType
type
)
const
;
virtual
~
ScaledDataset
();
private
:
svector
pos
;
svector
neg
;
};
// used for traning single octave scale
class
Octave
:
cv
::
Boost
{
public
:
enum
{
// Direct backward pruning. (Cha Zhang and Paul Viola)
DBP
=
1
,
// Multiple instance pruning. (Cha Zhang and Paul Viola)
MIP
=
2
,
// Originally proposed by L. bourdev and J. brandt
HEURISTIC
=
4
};
Octave
(
cv
::
Rect
boundingBox
,
int
npositives
,
int
nnegatives
,
int
logScale
,
int
shrinkage
);
virtual
~
Octave
();
virtual
bool
train
(
const
Dataset
&
dataset
,
const
FeaturePool
*
pool
,
int
weaks
,
int
treeDepth
);
virtual
float
predict
(
const
Mat
&
_sample
,
Mat
&
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
;
virtual
void
setRejectThresholds
(
cv
::
Mat
&
thresholds
);
virtual
void
write
(
CvFileStorage
*
fs
,
string
name
)
const
;
virtual
void
write
(
cv
::
FileStorage
&
fs
,
const
FeaturePool
*
pool
,
const
Mat
&
thresholds
)
const
;
int
logScale
;
protected
:
virtual
bool
train
(
const
cv
::
Mat
&
trainData
,
const
cv
::
Mat
&
responses
,
const
cv
::
Mat
&
varIdx
=
cv
::
Mat
(),
const
cv
::
Mat
&
sampleIdx
=
cv
::
Mat
(),
const
cv
::
Mat
&
varType
=
cv
::
Mat
(),
const
cv
::
Mat
&
missingDataMask
=
cv
::
Mat
());
void
processPositives
(
const
Dataset
&
dataset
,
const
FeaturePool
*
pool
);
void
generateNegatives
(
const
Dataset
&
dataset
,
const
FeaturePool
*
pool
);
float
predict
(
const
Mat
&
_sample
,
const
cv
::
Range
range
)
const
;
private
:
void
traverse
(
const
CvBoostTree
*
tree
,
cv
::
FileStorage
&
fs
,
int
&
nfeatures
,
int
*
used
,
const
double
*
th
)
const
;
virtual
void
initial_weights
(
double
(
&
p
)[
2
]);
cv
::
Rect
boundingBox
;
int
npositives
;
int
nnegatives
;
int
shrinkage
;
Mat
integrals
;
Mat
responses
;
CvBoostParams
params
;
Mat
trainData
;
};
}
#endif
\ No newline at end of file
apps/sft/octave.cpp
View file @
dd8de0c4
This diff is collapsed.
Click to expand it.
apps/sft/sft.cpp
View file @
dd8de0c4
...
...
@@ -127,12 +127,12 @@ int main(int argc, char** argv)
cv
::
Rect
boundingBox
=
cfg
.
bbox
(
it
);
std
::
cout
<<
"Object bounding box"
<<
boundingBox
<<
std
::
endl
;
sft
::
Octave
boost
(
boundingBox
,
npositives
,
nnegatives
,
*
it
,
shrinkage
);
cv
::
Octave
boost
(
boundingBox
,
npositives
,
nnegatives
,
*
it
,
shrinkage
);
std
::
string
path
=
cfg
.
trainPath
;
sft
::
Dataset
dataset
(
path
,
boost
.
logScale
);
sft
::
Scaled
Dataset
dataset
(
path
,
boost
.
logScale
);
if
(
boost
.
train
(
dataset
,
&
pool
,
cfg
.
weaks
,
cfg
.
treeDepth
))
if
(
boost
.
train
(
&
dataset
,
&
pool
,
cfg
.
weaks
,
cfg
.
treeDepth
))
{
CvFileStorage
*
fout
=
cvOpenFileStorage
(
cfg
.
resPath
(
it
).
c_str
(),
0
,
CV_STORAGE_WRITE
);
boost
.
write
(
fout
,
cfg
.
cascadeName
);
...
...
modules/ml/include/opencv2/ml/ml.hpp
View file @
dd8de0c4
...
...
@@ -2142,7 +2142,72 @@ public:
virtual
void
preprocess
(
const
Mat
&
frame
,
Mat
&
integrals
)
const
=
0
;
virtual
~
FeaturePool
()
=
0
;
virtual
~
FeaturePool
();
};
class
Dataset
{
public
:
typedef
enum
{
POSITIVE
=
1
,
NEGATIVE
=
2
}
SampleType
;
virtual
cv
::
Mat
get
(
SampleType
type
,
int
idx
)
const
=
0
;
virtual
int
available
(
SampleType
type
)
const
=
0
;
virtual
~
Dataset
();
};
// used for traning single octave scale
class
Octave
:
cv
::
Boost
{
public
:
enum
{
// Direct backward pruning. (Cha Zhang and Paul Viola)
DBP
=
1
,
// Multiple instance pruning. (Cha Zhang and Paul Viola)
MIP
=
2
,
// Originally proposed by L. bourdev and J. brandt
HEURISTIC
=
4
};
Octave
(
cv
::
Rect
boundingBox
,
int
npositives
,
int
nnegatives
,
int
logScale
,
int
shrinkage
);
virtual
~
Octave
();
virtual
bool
train
(
const
Dataset
*
dataset
,
const
FeaturePool
*
pool
,
int
weaks
,
int
treeDepth
);
virtual
float
predict
(
const
Mat
&
_sample
,
Mat
&
_votes
,
bool
raw_mode
,
bool
return_sum
)
const
;
virtual
void
setRejectThresholds
(
cv
::
Mat
&
thresholds
);
virtual
void
write
(
CvFileStorage
*
fs
,
string
name
)
const
;
virtual
void
write
(
cv
::
FileStorage
&
fs
,
const
FeaturePool
*
pool
,
const
Mat
&
thresholds
)
const
;
int
logScale
;
protected
:
virtual
bool
train
(
const
cv
::
Mat
&
trainData
,
const
cv
::
Mat
&
responses
,
const
cv
::
Mat
&
varIdx
=
cv
::
Mat
(),
const
cv
::
Mat
&
sampleIdx
=
cv
::
Mat
(),
const
cv
::
Mat
&
varType
=
cv
::
Mat
(),
const
cv
::
Mat
&
missingDataMask
=
cv
::
Mat
());
void
processPositives
(
const
Dataset
*
dataset
,
const
FeaturePool
*
pool
);
void
generateNegatives
(
const
Dataset
*
dataset
,
const
FeaturePool
*
pool
);
float
predict
(
const
Mat
&
_sample
,
const
cv
::
Range
range
)
const
;
private
:
void
traverse
(
const
CvBoostTree
*
tree
,
cv
::
FileStorage
&
fs
,
int
&
nfeatures
,
int
*
used
,
const
double
*
th
)
const
;
virtual
void
initial_weights
(
double
(
&
p
)[
2
]);
cv
::
Rect
boundingBox
;
int
npositives
;
int
nnegatives
;
int
shrinkage
;
Mat
integrals
;
Mat
responses
;
CvBoostParams
params
;
Mat
trainData
;
};
}
...
...
modules/ml/src/octave.cpp
View file @
dd8de0c4
This diff is collapsed.
Click to expand it.
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