Real Time Face Recognition with Raspberry Pi and OpenCV

Somnath Chowdhury's picture

Offline

Joined: May 09, 2019

Replies: 0
Real Time Face Recognition with Raspberry Pi and OpenCV
May 9, 2019 - 1:59am

I am getting this error, please help me solve it,

Traceback (most recent call last):
  File "Face_Trainer.py", line 44, in <module>
    recognizer.train(x_train, np.array(y_ID)) #Create a Matrix of Training data
cv2.error: OpenCV(3.4.4) /home/pi/packaging/opencv-python/opencv_contrib/modules/face/src/lbph_faces.cpp:362: error: (-210:Unsupported format or combination of formats) Empty training data was given. You'll need more than one sample to learn a model. in function 'train'

Thank you.

Aswinth Raj's picture

Offline

Joined: Aug 16, 2016

Replies: 888
Add sample images in the directory
May 10, 2019 - 10:52am

It means the directory from where you are executing the Face_trainer.py program, does not have sample images to generate trainign data. Read the article carefully to know how to set training data before compiling the program.