2013-01-29 16:26:12 +08:00
|
|
|
Soft Cascade Training
|
2013-01-29 23:18:22 +08:00
|
|
|
=======================
|
|
|
|
|
|
|
|
.. highlight:: cpp
|
|
|
|
|
|
|
|
Soft Cascade Detector Training
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::Octave
|
|
|
|
-------------------
|
|
|
|
.. ocv:class:: softcascade::Octave : public Algorithm
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-01-30 15:24:45 +08:00
|
|
|
Public interface for soft cascade training algorithm. ::
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
class Octave : public Algorithm
|
2013-01-29 23:18:22 +08:00
|
|
|
{
|
|
|
|
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 };
|
|
|
|
|
2013-02-01 18:25:10 +08:00
|
|
|
virtual ~Octave();
|
|
|
|
static cv::Ptr<Octave> create(cv::Rect boundingBox, int npositives, int nnegatives, int logScale, int shrinkage);
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth) = 0;
|
|
|
|
virtual void setRejectThresholds(OutputArray thresholds) = 0;
|
|
|
|
virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const = 0;
|
2013-03-23 00:51:45 +08:00
|
|
|
virtual void write( CvFileStorage* fs, String name) const = 0;
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::Octave::~Octave
|
2013-01-29 23:18:22 +08:00
|
|
|
---------------------------------------
|
2013-02-01 18:25:10 +08:00
|
|
|
Destructor for Octave.
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: softcascade::Octave::~Octave()
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::Octave::train
|
|
|
|
--------------------------
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: bool softcascade::Octave::train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth)
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
:param dataset an object that allows communicate for training set.
|
|
|
|
|
|
|
|
:param pool an object that presents feature pool.
|
|
|
|
|
|
|
|
:param weaks a number of weak trees should be trained.
|
|
|
|
|
|
|
|
:param treeDepth a depth of resulting weak trees.
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::Octave::setRejectThresholds
|
|
|
|
----------------------------------------
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: void softcascade::Octave::setRejectThresholds(OutputArray thresholds)
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
:param thresholds an output array of resulted rejection vector. Have same size as number of trained stages.
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::Octave::write
|
|
|
|
--------------------------
|
2013-01-29 23:18:22 +08:00
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: void softcascade::Octave::train(cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const
|
2013-03-23 00:51:45 +08:00
|
|
|
.. ocv:function:: void softcascade::Octave::train( CvFileStorage* fs, String name) const
|
2013-01-29 23:18:22 +08:00
|
|
|
|
|
|
|
:param fs an output file storage to store trained detector.
|
|
|
|
|
|
|
|
:param pool an object that presents feature pool.
|
|
|
|
|
|
|
|
:param dataset a rejection vector that should be included in detector xml file.
|
|
|
|
|
|
|
|
:param name a name of root node for trained detector.
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::FeaturePool
|
|
|
|
------------------------
|
|
|
|
.. ocv:class:: softcascade::FeaturePool
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
Public interface for feature pool. This is a hight level abstraction for training random feature pool. ::
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
class FeaturePool
|
2013-01-30 15:24:45 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual int size() const = 0;
|
|
|
|
virtual float apply(int fi, int si, const Mat& channels) const = 0;
|
|
|
|
virtual void write( cv::FileStorage& fs, int index) const = 0;
|
|
|
|
virtual ~FeaturePool();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::FeaturePool::size
|
|
|
|
------------------------------
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
Returns size of feature pool.
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: int softcascade::FeaturePool::size() const
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::FeaturePool::~FeaturePool
|
|
|
|
--------------------------------------
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
FeaturePool destructor.
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: softcascade::FeaturePool::~FeaturePool()
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::FeaturePool::write
|
|
|
|
-------------------------------
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
Write specified feature from feature pool to file storage.
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: void softcascade::FeaturePool::write( cv::FileStorage& fs, int index) const
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
:param fs an output file storage to store feature.
|
|
|
|
|
|
|
|
:param index an index of feature that should be stored.
|
|
|
|
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
softcascade::FeaturePool::apply
|
|
|
|
-------------------------------
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
Compute feature on integral channel image.
|
|
|
|
|
2013-02-20 18:38:16 +08:00
|
|
|
.. ocv:function:: float softcascade::FeaturePool::apply(int fi, int si, const Mat& channels) const
|
2013-01-30 15:24:45 +08:00
|
|
|
|
|
|
|
:param fi an index of feature that should be computed.
|
|
|
|
|
|
|
|
:param si an index of sample.
|
|
|
|
|
2013-08-27 18:23:26 +08:00
|
|
|
:param fs a channel matrix.
|