Commit 0b17a8bb3322844a96c1bbf8a3e10c03d91c7604
1 parent
df64be5e
Cleanup
Showing
1 changed file
with
0 additions
and
15 deletions
openbr/plugins/tree.cpp
| @@ -339,10 +339,6 @@ private: | @@ -339,10 +339,6 @@ private: | ||
| 339 | Mat samples = OpenCVUtils::toMat(data.data()); | 339 | Mat samples = OpenCVUtils::toMat(data.data()); |
| 340 | Mat labels = OpenCVUtils::toMat(File::get<float>(data, inputVariable)); | 340 | Mat labels = OpenCVUtils::toMat(File::get<float>(data, inputVariable)); |
| 341 | 341 | ||
| 342 | - for (int i=0; i<labels.rows; i++) { | ||
| 343 | - if (labels.at<float>(i,0) != 1) labels.at<float>(i,0) = 0; | ||
| 344 | - } | ||
| 345 | - | ||
| 346 | Mat types = Mat(samples.cols + 1, 1, CV_8U); | 342 | Mat types = Mat(samples.cols + 1, 1, CV_8U); |
| 347 | types.setTo(Scalar(CV_VAR_NUMERICAL)); | 343 | types.setTo(Scalar(CV_VAR_NUMERICAL)); |
| 348 | types.at<char>(samples.cols, 0) = CV_VAR_CATEGORICAL; | 344 | types.at<char>(samples.cols, 0) = CV_VAR_CATEGORICAL; |
| @@ -357,17 +353,6 @@ private: | @@ -357,17 +353,6 @@ private: | ||
| 357 | 353 | ||
| 358 | boost.train( samples, CV_ROW_SAMPLE, labels, Mat(), Mat(), types, Mat(), | 354 | boost.train( samples, CV_ROW_SAMPLE, labels, Mat(), Mat(), types, Mat(), |
| 359 | params); | 355 | params); |
| 360 | - | ||
| 361 | - QTime timer; | ||
| 362 | - timer.start(); | ||
| 363 | - int correct = 0; | ||
| 364 | - for (int i=0; i<samples.rows; i++) { | ||
| 365 | - float prediction = boost.predict(samples.row(i)); | ||
| 366 | - if (prediction == labels.at<float>(i,0)) | ||
| 367 | - correct++; | ||
| 368 | - } | ||
| 369 | - | ||
| 370 | - qDebug("Time to classify %d samples: %d ms\nAccuracy: %f\nSample dimensionality: %d",samples.rows,timer.elapsed(),(float)correct/samples.rows,samples.cols); | ||
| 371 | } | 356 | } |
| 372 | 357 | ||
| 373 | void project(const Template &src, Template &dst) const | 358 | void project(const Template &src, Template &dst) const |