facenet face recognition python tensorflow

Divided into face detection, face correction, feature extraction, feature comparison to get the threshold!
Face detection is based on opencv's own haar cascade classifier face detection, dlib face detection, seetaface funnel face detection, Yu Shiqi face detection, mtcnn face detection, in this article, choose mtcnn face detection, This algorithm has been tested on FDDB and has achieved good results, which is better than the former algorithms. Mtcnn is a face detection algorithm based on deep learning and convolutional neural network!
Face correction is to straighten the crooked face. This is conducive to feature extraction and can improve the recognition rate to a certain extent. This article uses mtcnn to locate the face and return to get the coordinates of the five points of the face, the coordinates of the two eyes, the coordinates of the nose, the coordinates of the two corners of the mouth, and the coordinates of the five coordinates. Position, use affine transformation algorithm to correct the face!
Feature extraction is the key step to determine the recognition rate. This article uses the inception-resnet network. The inception network is a network released by Google. The resnet network is a network proposed by Microsoft. Combine the two to form a better network. This article is trained in vggface2 Train the pre-training model on the set. On the basis of the pre-training model, train the data set of Chinese people, so that there is a better recognition effect on the face of Asian people. Simply use foreign data sets, in the actual test or test the Chinese The effect is very poor. lfw is a verification set for face recognition. When training the vggface2 data set, you can verify the accuracy on lfw!
Feature comparison, the feature is extracted in the previous step, 128-dimensional feature vector can be extracted, two faces are extracted 128-dimensional feature vector, and the cosine distance or Euclidean distance of the two feature vectors is calculated, and the similarity of the two feature vectors is obtained. That is, the similarity of two faces can determine whether the two faces are the same person. The cosine distance is the angle between the two vectors, which can be normalized to 0 to 1. The closer to 1, the more similar the two faces. Euclidean distance represents the distance between two vector spaces. The closer the two vector spaces are, the more similar the two people are. The minimum value is 0!
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_18522785/article/details/106559871