Let's see how we can build a face recognizer using a local binary patterns histogram:
- Create a new Python file and import the following packages (the full code is given in the face_recognizer.py file that is provided for you):
import os import cv2 import numpy as np from sklearn import preprocessing
- Let's define a class to handle all of the tasks that are related to label encoding for the classes:
# Class to handle tasks related to label encoding class LabelEncoder(object):
- Define a method to encode the labels. In the input training data, labels are represented by words. However, we need numbers to train our system. This method will define a preprocessor object that can convert words into numbers in an organized fashion ...