Face detection throws error: !empty() in function cv::CascadeClassifier::detectMultiScale

Refer to this line of code, it failed on checking that cascade is non empty. Please check path to XML files with trained cascades. You may need to specify full path to XML’s like this: face_cascade = cv2.CascadeClassifier(‘D:\opencv\data\haarcascades\haarcascade_frontalface_default.xml’) eye_cascade = cv2.CascadeClassifier(‘D:\opencv\data\haarcascades\haarcascade_eye.xml’) Or just put this files to directory containig your script.