Hi,
I have searched through this forum about this problem and I found no result. I wish that this question has never been asked before. I am very sorry if it has.
I test machine learning sample code from http://docs.opencv.org/3.2.0/dd/d3b/tutorial_py_svm_opencv.html and the result yields 0% accuracy.
After some investigation, this function call
result = svm.predict(testData)
does not return an array of result but it returns a tuple instead. I believe this is the output of print(result)
(0.0, array([[ 0.],
[ 0.],
[ 0.],
...,
[ 9.],
[ 9.],
[ 9.]], dtype=float32))
So, instead of writing
mask = result==responses
the solution that worked for me is
mask = result[1] == responses
I don't know, but maybe the tutorial needs update. My question is, what value is the first element of the tuple which returned by svm.predict(testData)
?
I have tried to find documentation but unfortunately I couldn't find any information about this function.
Thank you very much for your kind help.