recognizer= cv2.face.createLBPHFaceRecognizer()
if os.path.exists("recognizer\\trainingData_LBPHF.yml"):
recognizer.load("recognizer\\trainingData_LBPHF.yml")
IDs,faces=retrainer(directory)
recognizer.train(faces,IDs)
While I run this code my recognizer retrain on new pictures but lose everything that had been done before. Is there a way to retrain my recognizer on new additional pictures without retraining on the old ones in order to accelerate the processing?
You need to call update
:
recognizer.update(faces, IDs)
This method updates a (probably trained) FaceRecognizer, but only if the algorithm supports it. The Local Binary Patterns Histograms (LBPH) recognizer (see createLBPHFaceRecognizer) can be updated.