Face Search using images on your server

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:

  1. Manually create a Vector Database
  2. Capture Images from your required input medium
  3. Sent to the Face Vector API and get the target Vector Matrix
  4. Calculate Euclidean distance to find the match
Step 1: Creating your Vector Database
  • Each image is run through the Face Vector API and the Face Vector is obtained.
  • Each of the 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). Please ensure that each image is stored under a unique file name.
  • 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.(with 3 photos of each person, there would be a total of 300 Face Vectors)
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
  • If you are looking to implement annoy in Java, please refer to https://github.com/spotify/annoy-java
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.
Related Articles
Post a Comment