1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

amplement weidhting according to L. Bourdev and J. Brandt paper "Robust Object Detection Via Soft Cascade"

This commit is contained in:
marina.kolpakova
2012-12-12 15:35:30 +04:00
parent c091092174
commit a8d0e04912
4 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ protected:
float predict( const Mat& _sample, const cv::Range range) const;
private:
void traverse(const CvBoostTree* tree, cv::FileStorage& fs, const float* th = 0) const;
virtual void initial_weights(double (&p)[2]);
cv::Rect boundingBox;
int npositives;
+8
View File
@@ -295,6 +295,7 @@ void sft::Octave::generateNegatives(const Dataset& dataset)
dprintf("Processing negatives finished:\n\trequested %d negatives, viewed %d samples.\n", nnegatives, total);
}
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
@@ -378,6 +379,13 @@ void sft::Octave::write( cv::FileStorage &fso, const Mat& thresholds) const
<< "}";
}
void sft::Octave::initial_weights(double (&p)[2])
{
double n = data->sample_count;
p[0] = n / (double)(nnegatives) ;
p[1] = n / (double)(npositives);
}
bool sft::Octave::train(const Dataset& dataset, const FeaturePool& pool, int weaks, int treeDepth)
{
CV_Assert(treeDepth == 2);