Ask Your Question
0

confidace in facerecogniezer in opencv 3

asked 2017-03-30 17:10:13 -0600

Ameer gravatar image

Hello, this is my first question and i hope i will write it correctly here. Am currently working on face recognition using Opencv3, Python 3.5 and LBPH

all goes well till unknown picture appears, my code won't decide for it as unknown thus a random id will be set, the problem is with the confidence values since for some reason i can't get the confidence at all. i use this portion of code to find my prediction

id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])

this will result in the following error

Traceback (most recent call last):
  File "Recognition.py", line 39, in <module>
    id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])
TypeError: 'int' object is not iterable

and if i tried this

id, conf = recognizer.predict(faceNp[y: y + h, x: x + w])

it will work but i won't be able to label any face as -1 or do any further processing on the unknown faces i have looked in the previous question and i tried using

prediction, conf = self.application.recognizer.predict(test_image[y: y + h, x: x + w])

and it returned (couldn't solve this too )

Traceback (most recent call last):
  File "Recognition.py", line 39, in <module>
    id, conf = self.application.recognizer.predict(faceNp[y: y + h, x: x + w])
NameError: name 'self' is not defined

I wish i can find the answer and thanks for your time.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-31 02:31:16 -0600

berak gravatar image

so, that's 3 questions ..

  1. there was a bug in the python bindings, please uptdate opencv_contrib to latest master.

  2. you can set a threshold value in the constructor, so any distance exceeding that threshold will result in a -1 prediction

  3. self can only be used inside a class context, this is most likely a copy/paste error, try to remove it.

edit flag offensive delete link more

Comments

Hello Berak thanks for your replay, i was looking how to update openCV to recover from this bug, but am using virtual environment for openCV, i know this is irrelevant but can you guide me were or how to update the virtual environment contents.

thanks a lot

Ameer gravatar imageAmeer ( 2017-04-10 04:32:02 -0600 )edit

sorry, cannot help with that ;(

berak gravatar imageberak ( 2017-04-10 04:41:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-30 17:10:13 -0600

Seen: 307 times

Last updated: Mar 31 '17