Commit 8dea5a3e52e8231554df69062d6ec583ffaa3f55

Authored by Brendan Klare
1 parent 12468946

Sliding window uses "conf" as thresholdable value

openbr/plugins/slidingwindow.cpp
... ... @@ -104,7 +104,7 @@ private:
104 104 continue;
105 105 negRects.append(negRect);
106 106 Template neg(tmpl.file, Mat(tmpl, negRect));
107   - neg.file.set("Label", QString("0"));
  107 + neg.file.set("Label", QString("neg"));
108 108 full += neg;
109 109 sample++;
110 110 }
... ... @@ -147,19 +147,20 @@ private:
147 147  
148 148 for (double y = 0; y + windowHeight < scaleImg.rows; y += stepSize) {
149 149 for (double x = 0; x + windowWidth < scaleImg.cols; x += stepSize) {
150   -qDebug() << "x=" << x << "\ty=" << y;
151 150 Rect window(x, y, windowWidth, windowHeight);
152 151 Template windowMat(src.file, Mat(scaleImg, window));
153 152 Template detect;
154 153 transform->project(windowMat, detect);
  154 + float conf = detect.file.get<float>("conf");
  155 +
155 156 // the result will be in the Label
156   - if (detect.file.get<QString>("Label") == "pos") {
  157 + if (conf > 0) {
157 158 dst.file.appendRect(QRectF((float) x * scale, (float) y * scale, (float) windowWidth * scale, (float) windowHeight * scale));
158   - float confidence = detect.file.get<float>("Dist");
159 159 QList<float> confidences = dst.file.getList<float>("Confidences", QList<float>());
160   - confidences.append(confidence);
  160 + confidences.append(conf);
161 161 dst.file.setList<float>("Confidences", confidences);
162   - if (takeLargestScale) return;
  162 + if (takeLargestScale)
  163 + return;
163 164 }
164 165 }
165 166 }
... ...
openbr/plugins/svm.cpp
... ... @@ -157,7 +157,7 @@ private:
157 157 dst = src;
158 158 float prediction = svm.predict(src.m().reshape(1, 1), returnDFVal);
159 159 if (returnDFVal) {
160   - dst.file.set("Dist", prediction);
  160 + dst.file.set("conf", prediction);
161 161 // positive values ==> first class
162 162 // negative values ==> second class
163 163 prediction = prediction > 0 ? 0 : 1;
... ...