Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Dependencies between detector runs on LBP #5442

Open
almln opened this issue Oct 2, 2015 · 7 comments
Open

Bug: Dependencies between detector runs on LBP #5442

almln opened this issue Oct 2, 2015 · 7 comments

Comments

@almln
Copy link

almln commented Oct 2, 2015

There is some bug with cv::CascadeClassifier in case of lbpcascade_frontalface:
We have 3 photos (attached files arranged as 02463d131, 02463d139, 02463d142 respectively). Сonsistently run detector on them. For the last picture we get the wrong result. Remove, for example, the second photo. Now, the result for the third picture changed and became correct.
This observation is true only for lbp cascades. On haarcascade all is ok.
See attached files for more info.

Build info:
openCV 3.0.0, vc12, static

Code:

#include <opencv2\opencv.hpp>

int main() {

    std::string f1 = "C:/test/detection/imgs/02463d131.jpg";
    std::string f2 = "C:/test/detection/imgs/02463d139.jpg";
    std::string f3 = "C:/test/detection/imgs/02463d142.jpg";

    cv::Mat im1 = cv::imread(f1, CV_LOAD_IMAGE_GRAYSCALE);
    cv::Mat im2 = cv::imread(f2, CV_LOAD_IMAGE_GRAYSCALE);
    cv::Mat im3 = cv::imread(f3, CV_LOAD_IMAGE_GRAYSCALE);

    cv::CascadeClassifier faceCascade;
    bool isok = faceCascade.load("C:/test/detection/cv_bug/lbpcascade_frontalface.xml");
    //bool isok = faceCascade.load("C:/test/detection/cv_bug/haarcascade_frontalface_alt.xml");

    std::vector<cv::Rect> output1, output2, output3;
    faceCascade.detectMultiScale(im1, output1, 1.16, 1, 0, cv::Size(100, 100), cv::Size(0.99 * im1.cols, 0.99 * im1.cols));
    //faceCascade.detectMultiScale(im2, output2, 1.16, 1, 0, cv::Size(100, 100), cv::Size(0.99 * im2.cols, 0.99 * im2.cols));
    faceCascade.detectMultiScale(im3, output3, 1.16, 1, 0, cv::Size(100, 100), cv::Size(0.99 * im3.cols, 0.99 * im3.cols));

    std::cout << "02463d131.jpg: " << output1[0] << " Face detected: " << output1.size() << '\n';
    //std::cout << "02463d139.jpg: " << output2[0] << " Face detected: " << output2.size() << '\n';
    std::cout << "02463d142.jpg: " << output3[0] << " Face detected: " << output3.size() << '\n';

    std::cin.get();

    return 0;
}

results

02463d131
02463d139
02463d142

@almln almln changed the title Dependencies between detector runs on LBP Bug: Dependencies between detector runs on LBP Oct 2, 2015
@almln
Copy link
Author

almln commented Oct 2, 2015

This bug is connected with openCL. There is no problem with openCV build without openCL.

@StevenPuttemans
Copy link

OpenCL is known to cause issues. Either

  • Explicitly disable OpenCL in OpenCV building process
  • Or add ocl::setUseOpenCL(false); at the beginning of your code file

Both will make the sample work, just tested here locally.

@leugenea
Copy link

leugenea commented Sep 16, 2016

Tested again, now on Ubuntu 16.04.01, OpenCV 3.1.0, same issue.

@StevenPuttemans
Copy link

@leugenea did you disable OpenCL?

@leugenea
Copy link

@StevenPuttemans , yes, without OpenCL everything works just fine. And even on PCs without GPU (Intel or NVidia).

@StevenPuttemans
Copy link

BTW just confirmed again with a collegue, this bug is still alive. OpenCL implementation of detectMultiscale completely brakes down the detector, while explicitly disabling OpenCL makes it run just fine!

@sturkmen72
Copy link
Contributor

just a note:
i was tested this issue before and get same result like

this image

i tested now and it works as expected.

( recently i updated display driver : Intel(R) HD Graphics 4000 10.18.10.4653 ) maybe outdated display driver was the reason. or the bug is fixed somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants