How to save trained data for Face recognisation

asked 2016-08-01 06:35:06 -0600

vasu12360 gravatar image

I am working on a face recognition program using cv2.createLBPHFaceRecognizer() on python given at:

I am able to add new faces in database however, I want to save the trained data in a file so that i don't have to retrain same database how could i do so.

edit retag flag offensive close merge delete



if it's really about LBPH, i would not waste too much energy on that.

the "training" only consists of making lbph features from the images, which is done in a jiffy.

do that once , when your prog starts, then keep the trained model in memory. also remember, that there's an "update" method for LBPH (only), that allows you to add new faces to an already trained model.

berak gravatar imageberak ( 2016-08-01 07:12:09 -0600 )edit

but how do i store trained model in memory.I will rely appreciate if you can guide me through this or suggest me some links which can help me to implement LBPH as i am not much proficient in opencv

vasu12360 gravatar imagevasu12360 ( 2016-08-01 11:46:15 -0600 )edit

which opencv version is it ?

berak gravatar imageberak ( 2016-08-01 11:47:31 -0600 )edit

opencv 2.4.13 , python 2.7

vasu12360 gravatar imagevasu12360 ( 2016-08-01 12:05:23 -0600 )edit

hmm, looking at it, it does not really seem supported from python.

using would be straightforward, unfortunately it's not wrapped into the python bindings (no cv::FileStorage there)

you'd have to use recognizer.get("something") on all of the properties here, do your own serialization, and use recognizer.set("something) to put it back later.

not a piece of cake. not funny. (and i'm quite sure, you don't even need it)

berak gravatar imageberak ( 2016-08-01 12:18:10 -0600 )edit

again, please measure the time used by recognozer.train(), before starting something desperate. (how many images do you plan to process ?)

again, if that's less than a million, - just train your recognizer instance, and keep it as long as possible.

berak gravatar imageberak ( 2016-08-01 12:20:31 -0600 )edit

i would need to train 200-500 image

vasu12360 gravatar imagevasu12360 ( 2016-08-01 12:46:34 -0600 )edit

so, don't bother.

berak gravatar imageberak ( 2016-08-01 12:48:36 -0600 )edit