How to check if FaceRecognizer model is trained

asked 2015-04-24 03:42:13 -0600

kemter2013 gravatar image

When I call LBPHFaceRecognizer::predict method I get the following error: OpenCV Error: Bad argument (This LBPH model is not computed yet. Did you call the train method?)

Is it possible to check if model of LBPHFaceRecognizer is trained or not?

edit retag flag offensive close merge delete

Comments

Simply said, did you actually use a piece of code that says recognizer.train() or recognizer->train()?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-24 03:59:21 -0600 )edit
1

no such function built in.

but yes, rather than testing, you'd want to make sure, that you either train it before, or load a serialized model. more a programming logic problem, imho.

berak gravatar imageberak ( 2015-04-24 08:49:13 -0600 )edit

more a programming logic problem

I don't think so. Trained is internal state of FaceRecognizer's model, but not the state of my app.

kemter2013 gravatar imagekemter2013 ( 2015-04-29 01:08:25 -0600 )edit

And look at this http://docs.opencv.org/master/db/d7d/...

Here isTrained is presented, but unfortunately it is not related to models of FaceRecognizers

kemter2013 gravatar imagekemter2013 ( 2015-04-29 01:11:00 -0600 )edit
1

^^ well, right, StatModel's have it and this thing not.

so you want to make Trained an internal state of your own app, by checking the return value from load() or such and keeping that around

berak gravatar imageberak ( 2015-04-29 01:12:16 -0600 )edit