Encrypted Face Recognition with enVector

In this tutorial, we will demonstrate how to use enVector to securely store and search face templates without revealing sensitive information.

Risk of being impersonated through face reconstruction

A face template is extracted from individuals and stored in the database. The template is compared with others in the database for either verification or identification. However, the template is still privacy-sensitive shown by the recent many studies. This is called face template inversion (TI) attack, which reconstructs the original face image from the face template. Even though these templates look like meaningless vectors, an attacker who steals them could potentially rebuild a person's face or impersonate them elsewhere. The figure below shows how original face from the left can be reconstructed to the right.

Face Template Inversion Attack

That is why we focus on encryption: keeping face templates secure even if when they are being matched.

This EFR tutorial follows the steps below:

  1. Administration to enVector server

    1. Load Image Dataset

    2. Extract Face Templates from Images

    3. enVector Initialization

    4. Insert Encrypted Face Templates

  2. Encrypted Face Recognition

    1. Get Query Face Template

    2. Encrypted Similarity Search Computation

Administration to enVector server

In this section, we will store encrypted face templates into enVector server.

Load Image Dataset

We start by pointing the notebook to the directory that contains example face images.

In this example, we used 10 face images from https://thispersonnotexist.org/arrow-up-right. Note that, this dataset is generated by AI, and the source website demonstrates that they grant permission for commercial purposes.

Get Face Templates from Images

This step extracts face templates (face embedding vectors) from every image.

enVector Initialization

Before we can insert ciphertexts into an index, the client must initialize enVector. This includes enVector server connection setup and cryptographic key generation. And then, we create the index on the server side to store encrypted face templates.

Insert Encrypted Face Templates

And we encrypt each template and insert them to the enVector index.

Select one face image as a query to extract the face template. This query template is sent to the enVector server for 1:N identification by encrypted similarity search.

Get Query Face Template

For example, we reuse the same query image to check whether it matches correctly. If you want to test another person, select a different image file for query.

png

Encrypted Similarity Search Computation

Match the face template against the database. enVector performs the similarity computation on encrypted data using fully homomorphic encryption (FHE). The computation result is sent to the key server to get matching decision by decrypting the result ciphertext safely in a secured environment.

Decrypting the Search Results

The secret key held by client is required to interpret the encrypted similarity scores returned from the server. Note that, client holds the secret key securely, and it is never shared with the server.

Metadata Retrieval

Once a match is found, we pull the associated metadata (such as a user identifier or display name) from the reference dataset. This step is optional but it completes the story by showing how an application would translate an encrypted match back into something meaningful for the operator.

Last updated