Face recognition development and large-scale face database retrieval
06 September 2021
Author： Wang Sisong, Engineering Lead
Face Recognition Development and Large-scale Face
Face Recognition is an image processing technology that retrieves similar faces from a face database through a picture, which is mainly used in personal identification-related businesses. With the development of AI, Face Recognition has made great strides in recent years and has gradually penetrated into all aspects of public life, such as unlocking mobile phones by taking a picture of your face, face-scanning payment, face-scanning fraud recognition and so on.
At Tokyo 2020 Olympic and Paralympic Games, the technology of Face Recognition also made a spectacular appearance and contributed to the security posture. It was the first time in Olympic history that using face recognition systems in all Olympic venues to help improve the efficiency of security at the Olympic Games. It is reported that at the Games, the face recognition security system has been involved in identifying more than 300,000 international athletes, volunteers, media reporters and other staff.
1. Basic processes of Face Recognition development
The prerequisite for Face Recognition development is extracting highly recognisable face features, such as eye distances and face contours. Meanwhile, these face features need to digitalise and form into unified vectors. In engineering, the vector is usually stored as a floating-point array.
The process of converting face images into face features is called "face feature extraction". With digital features, the algorithm can implement the comparison between face feature vectors, and the similarity between features can be calculated to achieve the face feature retrieval task.
The main workflow of Face Recognition development is as follows:
Step 1: Face detection
With face detection, the submitted image is scanned sequentially to detect possible face locations, and the face region is accurately identified by the classifier. During this phase, the algorithm can handle variations in face size and rotation angle, as well as normalising the face region.
Step 2: Feature extraction
After getting the normalised face image, the feature areas in the face are identified and labelled in this step. The information is encoded to obtain face features that are unique to each individual.
Step 3: Feature comparison
After the face feature vectors are obtained, the Euclidean distances between the input vectors and the other feature vectors in the face database are calculated. Each calculated distance is then filtered and sorted by the threshold, and the filtered face features are likely to be face images from the same person.
2. Technical requirements of building a massive face database
In general, the biggest challenge in developing Face Recognition is how to build a massive face database. As we know, creating a database containing billions of face images is much more complicated than building a small-scale database.
The following technical requirements are indispensable for building a billion-volume face image database:
For customers with billions of face images, the request-response time needs to be under 3s, while for customers with millions of face images, it is required to be under 300ms.
Due to the requirements of large volumes of data and the limitations of the standalone solution, the system and data need to be distributed on multiple machines.
The face database needs the ability to support real-time dynamic growth. For example, the face search engine tool developed by ADVANCE.AI can deposit faces from input requests into the face database in real time, as required by the business attributes.
The face database needs to maintain persistence, and when one of the nodes is disconnected, it needs to be able to recover the data from the disconnected node.
The system needs to be able to provide node management capabilities such as adding nodes, deleting nodes, and the ability of data slicing.
In the event of some nodes are unavailable, and the system is still able to respond to requests.
3. Implementation of face feature retrieval
In engineering, a high-performance face search engine can be developed to realise efficient and accurate face image retrieval.
The face search engine is usually created as a basic service. First, it needs to segregate face data by custom tags such as business type, customer, country, and time. Then, in terms of data storage, the associated face features can be stored in contiguous memory blocks according to pre-defined retrieval criteria, and the data for the same index needs to be evenly distributed across the machines within the cluster.
When a retrieval request hits a node in the cluster, that node will broadcast the request to all nodes in the cluster. Each node will perform the same operation and filter through the index to get the relevant feature blocks, then perform face matching calculations block by block, followed by conditional filtering, and finally aggregate to the node where the request came in and return it to the client.
And when an insertion request hits a node in the cluster, that node will calculate the Hash Slot of the feature first and forward the request to the corresponding node for storage.
The above is only a brief overview of the two main commands. If you choose to implement a distributed face feature retrieval solution based on the Redis module, you can implement a wider range of custom commands. At the same time, the Redis module also supports automatic data persistence, horizontal scaling, zero-copy memory performance, and server-side search with greater data protection.