The Face Vector API (read the user guide for the API here) can be used to create an online-based facial recognition system that would be able to search a database.
What this implies is that you can create a collection of your users photos (be it customers, students or employees who opt-in for facial recognition) and once the collection is ready, you can use online API calls to compare one new photo of a person against your complete database and determine the closest match and identify the person.
This image database of users can be stored either on our user portal or on your server.
Online database on our server using Face Search API
If you require an easy way of creating and controlling an online image database, you can go for our Face Search API.
- When using the Face Search API, the images and one unique user id for the person has to be uploaded and registered in the FaceX user portal.
- Once the registration is done, you can upload images to the FaceX server through Face Search Image API and the API will tell you who the person is by comparing with your database
Using an Image database on your server using Face vector API only
When you wish to use the images stored on your database without uploading the images to our database, there are a few steps you would have to do:
- Manually create a Vector Database
- Capture Images from your required input medium
- Sent to the Face Vector API and get the target Vector Matrix
- Calculate Euclidean distance to find the match
Step 1: Creating your Vector Database
- For best results, it is recommended that three photos be taken for each person: Looking forward(0 deg.), looking to the left and right at 45-degree angles.
- Each image is run through the Face Vector API and the Face Vector is obtained (with 3 photos of each person, there would be a total of 300 Face Vectors).
- Each of the 300 Face Vectors obtained is stored in a database under a unique ID for each person (which can be the person’s name or their employee code).
Step 2: Capture Images from your required input Medium
- Our APIs work with Images only, in order to recognize people from a live video stream, face detection SDKs are required. Currently, we offer Face Detection SDKs for Android & iOS and docker instances (which is in beta testing) that are compatible with Linux/ Ubuntu systems.
- If you are looking to recognize people from other platforms (Mobile or web-browser), it is recommended to ask your users to take a photo to ensure maximum accuracy. (Read Image Quality Requirements for API)
Step 3: Run the image through Face Vector API and get the target Vector Matrix
- Once the image is captured, you need to post the image to the Face Vector API once again and get the Vector Matrix
- Now you have the target image’s Vector Matrix as well as your Vector Database for Searching.
Step 4: Euclidian Distance Calculation
- If your database is of a smaller size, you can directly calculate the Euclidian distance between your target matrix and all the matrices in your database one at a time
- A sample python code is provided in this article
- If your database if of a larger size, you would need to go with ANNOY search. Please refer to github.com/spotify/annoy
Step 5: Interpret the result
- If the target Vector Matrix has Euclidian distance less than 0.5 with any of the images in your Vector database, that means they are a match
- If the target Vector Matrix has Euclidian distance more than 0.5 with all of the images in your Vector database, that means there is no match in your database for this person.