cc83b38e43c80e34bf23471be0f7bbe96445a92b
[platform/upstream/opencv.git] / modules / softcascade / doc / softcascade_training.rst
1 Soft Cascade Training
2 =======================
3
4 .. highlight:: cpp
5
6 Soft Cascade Detector Training
7 --------------------------------------------
8
9
10 softcascade::Octave
11 -------------------
12 .. ocv:class:: softcascade::Octave : public Algorithm
13
14 Public interface for soft cascade training algorithm. ::
15
16     class Octave : public Algorithm
17     {
18     public:
19
20         enum {
21             // Direct backward pruning. (Cha Zhang and Paul Viola)
22             DBP = 1,
23             // Multiple instance pruning. (Cha Zhang and Paul Viola)
24             MIP = 2,
25             // Originally proposed by L. Bourdev and J. Brandt
26             HEURISTIC = 4 };
27
28         virtual ~Octave();
29         static cv::Ptr<Octave> create(cv::Rect boundingBox, int npositives, int nnegatives, int logScale, int shrinkage);
30
31         virtual bool train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth) = 0;
32         virtual void setRejectThresholds(OutputArray thresholds) = 0;
33         virtual void write( cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const = 0;
34         virtual void write( CvFileStorage* fs, String name) const = 0;
35
36     };
37
38
39
40 softcascade::Octave::~Octave
41 ---------------------------------------
42 Destructor for Octave.
43
44 .. ocv:function:: softcascade::Octave::~Octave()
45
46
47 softcascade::Octave::train
48 --------------------------
49
50 .. ocv:function:: bool softcascade::Octave::train(const Dataset* dataset, const FeaturePool* pool, int weaks, int treeDepth)
51
52     :param dataset an object that allows communicate for training set.
53
54     :param pool an object that presents feature pool.
55
56     :param weaks a number of weak trees should be trained.
57
58     :param treeDepth a depth of resulting weak trees.
59
60
61
62 softcascade::Octave::setRejectThresholds
63 ----------------------------------------
64
65 .. ocv:function:: void softcascade::Octave::setRejectThresholds(OutputArray thresholds)
66
67     :param thresholds an output array of resulted rejection vector. Have same size as number of trained stages.
68
69
70 softcascade::Octave::write
71 --------------------------
72
73 .. ocv:function:: void softcascade::Octave::train(cv::FileStorage &fs, const FeaturePool* pool, InputArray thresholds) const
74 .. ocv:function:: void softcascade::Octave::train( CvFileStorage* fs, String name) const
75
76     :param fs an output file storage to store trained detector.
77
78     :param pool an object that presents feature pool.
79
80     :param dataset a rejection vector that should be included in detector xml file.
81
82     :param name a name of root node for trained detector.
83
84
85 softcascade::FeaturePool
86 ------------------------
87 .. ocv:class:: softcascade::FeaturePool
88
89 Public interface for feature pool. This is a hight level abstraction for training random feature pool. ::
90
91     class FeaturePool
92     {
93     public:
94
95         virtual int size() const = 0;
96         virtual float apply(int fi, int si, const Mat& channels) const = 0;
97         virtual void write( cv::FileStorage& fs, int index) const = 0;
98         virtual ~FeaturePool();
99
100     };
101
102 softcascade::FeaturePool::size
103 ------------------------------
104
105 Returns size of feature pool.
106
107 .. ocv:function:: int softcascade::FeaturePool::size() const
108
109
110
111 softcascade::FeaturePool::~FeaturePool
112 --------------------------------------
113
114 FeaturePool destructor.
115
116 .. ocv:function:: softcascade::FeaturePool::~FeaturePool()
117
118
119
120 softcascade::FeaturePool::write
121 -------------------------------
122
123 Write specified feature from feature pool to file storage.
124
125 .. ocv:function:: void softcascade::FeaturePool::write( cv::FileStorage& fs, int index) const
126
127     :param fs an output file storage to store feature.
128
129     :param index an index of feature that should be stored.
130
131
132 softcascade::FeaturePool::apply
133 -------------------------------
134
135 Compute feature on integral channel image.
136
137 .. ocv:function:: float softcascade::FeaturePool::apply(int fi, int si, const Mat& channels) const
138
139     :param fi an index of feature that should be computed.
140
141     :param si an index of sample.
142
143     :param fs a channel matrix.