OpenCV Error: Unspecified error

78 views
Skip to first unread message

tizian...@gmail.com

unread,
Jan 14, 2018, 3:56:48 PM1/14/18
to OpenCV with Python Blueprints
Hi Michael,
I create the faces_preprocessed.pkl and mlp.xml 
but running chapter7.py in the phase of testing mode when the face is detected, I receive this error:

"OpenCV Error: Unspecified error (The network has not been trained or loaded) in cv::ml::ANN_MLPImpl::predict, file C:\projects\opencv-python\opencv\modules\ml\src\ann_mlp.cpp, line 245
Traceback (most recent call last):
  File "D:\COLLOQUIO24\py27\cap_7_nuovo\gui.py", line 135, in _on_next_frame
    frame = self._process_frame(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
  File "D:/COLLOQUIO24/py27/cap_7_nuovo/chapter7.py", line 189, in _process_frame
    label = self.MLP.predict(np.array(X))[0]
  File "D:\COLLOQUIO24\py27\cap_7_nuovo\classifiers.py", line 269, in predict
    ret, y_hat = self.model.predict(X_test)
cv2.error: C:\projects\opencv-python\opencv\modules\ml\src\ann_mlp.cpp:245: error: (-2) The network has not been trained or loaded in function cv::ml::ANN_MLPImpl::predict"

line 269:   ret, y_hat = self.model.predict(X_test)

I use python 2.7, opencv 3.3.1

Please help me,

Best regards.




Reply all
Reply to author
Forward
0 new messages