Getting error in xml loading


error:
cv2.error: OpenCV(4.3.0) C:\projects\opencv-python\opencv\modules\objdetect\src\cascadedetect.cpp:569: error: (-2:Unspecified error) in function ‘bool _cdecl cv::HaarEvaluator::Feature::read(const class cv::FileNode &,const class cv::Size &)’

Invalid HAAR feature (expected: ‘rw.r.x + rw.r.width <= W’), where
‘rw.r.x + rw.r.width’ is 22
must be less than or equal to
‘W’ is 16

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “d:\data science\snapchat filters challenge\snapchat.py”, line 5, in
eyesdetector =cv2.CascadeClassifier(“Train/third-party/frontalEyes35x16.xml”)
SystemError: <class ‘cv2.CascadeClassifier’> returned a result with an error set

Hey @pandeyaman461, you need to decrease the opencv version using the following command,

!pip install opencv-python==3.4.2.16

Hope this resolved your doubt. :slight_smile: