• Andrey Kamaev's avatar
    Unified handling of InputOutputArrays in Python wrapper generator · e75df563
    Andrey Kamaev authored
    This makes arguments of type InputOutputArray required in python unless they
    have a default value in C++.
    
    As result following python functions changes signatures in non-trivial way:
    
    * calcOpticalFlowFarneback
    * calcOpticalFlowPyrLK
    * calibrateCamera
    * findContours
    * findTransformECC
    * floodFill
    * kmeans
    * PCACompute
    * stereoCalibrate
    
    And the following functions become return their modified inputs as a return
    value:
    
    * accumulate
    * accumulateProduct
    * accumulateSquare
    * accumulateWeighted
    * circle
    * completeSymm
    * cornerSubPix
    * drawChessboardCorners
    * drawContours
    * drawDataMatrixCodes
    * ellipse
    * fillConvexPoly
    * fillPoly
    * filterSpeckles
    * grabCut
    * insertChannel
    * line
    * patchNaNs
    * polylines
    * randn
    * randShuffle
    * randu
    * rectangle
    * setIdentity
    * updateMotionHistory
    * validateDisparity
    * watershed
    e75df563
softcascade_detector.rst 6.03 KB

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:

\texttt{H}(x) = \sum _{\texttt{t}=1..\texttt{T}} {\texttt{s}_t(x)}

where \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

\texttt{H}_t(x) = \sum _{\texttt{i}=1..\texttt{t}} {\texttt{s}_i(x)}

be the partial sum of sample responses before t -the weak classifier will be applied. The function \texttt{H}_t(x) of t for sample x named sample trace. After each weak classifier evaluation, the sample trace at the point t is compared with the rejection threshold r_t . The sequence of 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 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.

softcascade::Detector

Implementation of soft (stageless) cascaded detector.

class Detector : public Algorithm
{
public:

    enum { NO_REJECT = 1, DOLLAR = 2, /*PASCAL = 4,*/ DEFAULT = NO_REJECT};

    Detector(double minScale = 0.4, double maxScale = 5., int scales = 55, int rejCriteria = 1);
    virtual ~Detector();
    cv::AlgorithmInfo* info() const;
    virtual bool load(const FileNode& fileNode);
    virtual void read(const FileNode& fileNode);
    virtual void detect(InputArray image, InputArray rois, std::vector<Detection>& objects) const;
    virtual void detect(InputArray image, InputArray rois, OutputArray rects, OutputArray confs) const;

}

softcascade::Detector::Detector

An empty cascade will be created.

softcascade::Detector::~Detector

Destructor for Detector.

softcascade::Detector::load

Load cascade from FileNode.

softcascade::Detector::detect

Apply cascade to an input frame and return the vector of Detection objects.

softcascade::ChannelFeatureBuilder

Public interface for of soft (stageless) cascaded detector.

class ChannelFeatureBuilder : public Algorithm
{
public:
    virtual ~ChannelFeatureBuilder();

    virtual void operator()(InputArray src, OutputArray channels) const = 0;

    static cv::Ptr<ChannelFeatureBuilder> create();
};

softcascade::ChannelFeatureBuilder:~ChannelFeatureBuilder

Destructor for ChannelFeatureBuilder.

softcascade::ChannelFeatureBuilder::operator()

Create channel feature integrals for input image.