In the previous recipe, we demonstrated how to detect facial keypoints with a neural network. In the following recipe, we will show how to recognize faces using a deep neural network. By training a classifier from scratch, we get a lot of flexibility.
Recognizing faces
How to do it...
- As usual, let's start with importing the libraries and setting the seed:
import glob
import re
import matplotlib.pyplot as plt
import numpy as np
import cv2
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from keras.models import Model
from keras.layers import Flatten, Dense, Input, GlobalAveragePooling2D, GlobalMaxPooling2D, Activation
from keras.layers...