summaryrefslogtreecommitdiff
path: root/face-detection/02_face_training.py
diff options
context:
space:
mode:
Diffstat (limited to 'face-detection/02_face_training.py')
-rw-r--r--face-detection/02_face_training.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/face-detection/02_face_training.py b/face-detection/02_face_training.py
index 68b21fe..a0d5a43 100644
--- a/face-detection/02_face_training.py
+++ b/face-detection/02_face_training.py
@@ -26,6 +26,9 @@ print ("\n [INFO] Training faces. It will take a few seconds. Wait ...")
faces,ids = getImagesAndLabels(path)
#Train the LBPH recognizer using the face samples and their corresponding labels
recognizer.train(faces, np.array(ids))
+# if trainer folder doesnt exist create:
+if not os.path.exists("trainer"):
+ os.makedirs("trainer")
#save the model into trainer/trainer.yml
recognizer.write('trainer/trainer.yml')
# Print the numer of faces trained and then exit the program