mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 06:10:02 +08:00
GPU soft cascade documentation
This commit is contained in:
parent
916967cac5
commit
d3ac282487
@ -199,6 +199,125 @@ Returns block descriptors computed for the whole image.
|
|||||||
The function is mainly used to learn the classifier.
|
The function is mainly used to learn the classifier.
|
||||||
|
|
||||||
|
|
||||||
|
Soft Cascade Classifier
|
||||||
|
======================
|
||||||
|
|
||||||
|
Soft Cascade Classifier for Object Detection
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
Cascade detectors have been shown to operate extremely rapidly, with high accuracy, and have important applications in different spheres. The initial goal for this cascade implementation was the fast and accurate pedestrian detector but it also useful in general. Soft cascade is trained with AdaBoost. But instead of training sequence of stages, the soft cascade is trained as a one long stage of T weak classifiers. Soft cascade is formulated as follows:
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\texttt{H}(x) = \sum _{\texttt{t}=1..\texttt{T}} {\texttt{s}_t(x)}
|
||||||
|
|
||||||
|
where :math:`\texttt{s}_t(x) = \alpha_t\texttt{h}_t(x)` are the set of thresholded weak classifiers selected during AdaBoost training scaled by the associated weights. Let
|
||||||
|
|
||||||
|
.. math::
|
||||||
|
\texttt{H}_t(x) = \sum _{\texttt{i}=1..\texttt{t}} {\texttt{s}_i(x)}
|
||||||
|
|
||||||
|
be the partial sum of sample responses before :math:`t`-the weak classifier will be applied. The funtcion :math:`\texttt{H}_t(x)` of :math:`t` for sample :math:`x` named *sample trace*.
|
||||||
|
After each weak classifier evaluation, the sample trace at the point :math:`t` is compared with the rejection threshold :math:`r_t`. The sequence of :math:`r_t` named *rejection trace*.
|
||||||
|
|
||||||
|
The sample has been rejected if it fall rejection threshold. So stageless cascade allows to reject not-object sample as soon as possible. Another meaning of the sample trace is a confidence with that sample recognized as desired object. At each :math:`t` that confidence depend on all previous weak classifier. This feature of soft cascade is resulted in more accurate detection. The original formulation of soft cascade can be found in [BJ05]_.
|
||||||
|
|
||||||
|
.. [BJ05] Lubomir Bourdev and Jonathan Brandt. tRobust Object Detection Via Soft Cascade. IEEE CVPR, 2005.
|
||||||
|
.. [BMTG12] Rodrigo Benenson, Markus Mathias, Radu Timofte and Luc Van Gool. Pedestrian detection at 100 frames per second. IEEE CVPR, 2012.
|
||||||
|
|
||||||
|
|
||||||
|
SCascade
|
||||||
|
----------------
|
||||||
|
.. ocv:class:: SCascade
|
||||||
|
|
||||||
|
Implementation of soft (stageless) cascaded detector. ::
|
||||||
|
|
||||||
|
class CV_EXPORTS SCascade : public Algorithm
|
||||||
|
{
|
||||||
|
struct CV_EXPORTS Detection
|
||||||
|
{
|
||||||
|
ushort x;
|
||||||
|
ushort y;
|
||||||
|
ushort w;
|
||||||
|
ushort h;
|
||||||
|
float confidence;
|
||||||
|
int kind;
|
||||||
|
|
||||||
|
enum {PEDESTRIAN = 0};
|
||||||
|
};
|
||||||
|
|
||||||
|
SCascade(const double minScale = 0.4, const double maxScale = 5., const int scales = 55, const int rejfactor = 1);
|
||||||
|
virtual ~SCascade();
|
||||||
|
virtual bool load(const FileNode& fn);
|
||||||
|
virtual void detect(InputArray image, InputArray rois, OutputArray objects, Stream& stream = Stream::Null()) const;
|
||||||
|
virtual void detect(InputArray image, InputArray rois, OutputArray objects, const int level, Stream& stream = Stream::Null()) const;
|
||||||
|
void genRoi(InputArray roi, OutputArray mask, Stream& stream = Stream::Null()) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
SCascade::SCascade
|
||||||
|
--------------------------
|
||||||
|
An empty cascade will be created.
|
||||||
|
|
||||||
|
.. ocv:function:: bool SCascade::SCascade(const float minScale = 0.4f, const float maxScale = 5.f, const int scales = 55, const int rejfactor = 1)
|
||||||
|
|
||||||
|
:param minScale: a minimum scale relative to the original size of the image on which cascade will be applyed.
|
||||||
|
|
||||||
|
:param maxScale: a maximum scale relative to the original size of the image on which cascade will be applyed.
|
||||||
|
|
||||||
|
:param scales: a number of scales from minScale to maxScale.
|
||||||
|
|
||||||
|
:param rejfactor: used for non maximum suppression.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SCascade::~SCascade
|
||||||
|
---------------------------
|
||||||
|
Destructor for SCascade.
|
||||||
|
|
||||||
|
.. ocv:function:: SCascade::~SCascade()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SCascade::load
|
||||||
|
--------------------------
|
||||||
|
Load cascade from FileNode.
|
||||||
|
|
||||||
|
.. ocv:function:: bool SCascade::load(const FileNode& fn)
|
||||||
|
|
||||||
|
:param fn: File node from which the soft cascade are read.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SCascade::detect
|
||||||
|
--------------------------
|
||||||
|
Apply cascade to an input frame and return the vector of Decection objcts.
|
||||||
|
|
||||||
|
.. ocv:function:: void detect(InputArray image, InputArray rois, OutputArray objects, Stream& stream = Stream::Null()) const
|
||||||
|
.. ocv:function:: void detect(InputArray image, InputArray rois, OutputArray objects, const int level, Stream& stream = Stream::Null()) const
|
||||||
|
|
||||||
|
:param image: a frame on which detector will be applied.
|
||||||
|
|
||||||
|
:param rois: a regions of interests mask generated by genRoi. Only the objects that fall into one of the regions will be returned.
|
||||||
|
|
||||||
|
:param objects: an output array of Detections represented as GpuMat of detections (SCascade::Detection). The first element of the matrix is actually a count of detections.
|
||||||
|
|
||||||
|
:param stream: a high-level CUDA stream abstraction used for asynchronous execution.
|
||||||
|
|
||||||
|
:param level: used for execution cascade on specific scales pyramid level.
|
||||||
|
|
||||||
|
|
||||||
|
SCascade::genRoi
|
||||||
|
--------------------------
|
||||||
|
Convert ROI matrix into the suitable for detect method.
|
||||||
|
|
||||||
|
.. ocv:function:: void genRoi(InputArray roi, OutputArray mask, Stream& stream = Stream::Null()) const
|
||||||
|
|
||||||
|
:param rois: an input matrix of the same size as the image. There non zero value mean that detector should be executed in this point.
|
||||||
|
|
||||||
|
:param mask: an output mask
|
||||||
|
|
||||||
|
:param stream: a high-level CUDA stream abstraction used for asynchronous execution.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gpu::CascadeClassifier_GPU
|
gpu::CascadeClassifier_GPU
|
||||||
--------------------------
|
--------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user