Logo

FACE FIND

A Django Web Application to help find missing people using Face Recognition.

Now deployed on Heroku! Click here to check it out!

GitHub code size in bytes GitHub last commit Languages Generic badge


Table of Contents
  1. About The Project
  2. Getting Started
  3. Business Logic
  4. Tech Architecture
  5. Features and Interfaces
  6. Discussions
  7. Lessons Learnt
  8. Future Work

About The Project

The thought of a family member, a friend or someone else you care about going missing can be terrifying. This project aims to help find your loved ones using Face Recognition Technology. If someone you know is missing, then,

  • Register the missing person with us.
  • Once the background check is done and the missing person is verified, we generate a unique Face ID for the missing person using Azure's Face API.
  • When volunteers report a suspected missing person, we verify and generate a Face ID the same way. We then use Azure's Find Similar API to identify a potential match with our database of missing person Face IDs.
  • If a match is found we will contact you.

(back to top)

Built With

To achieve the goal of finding missing people, I made use of the following tools and languages,

bootstrap css3 javascript html5 express express express express git heroku

(back to top)

Getting Started

Prerequisites

Firstly you have to make sure you have python installed. If you don't have python, you can get it here.

  • Use this command to check if python is installed,
python --version

Getting API credentials

To access Azure Cognitive Services REST API for Face Analysis, you will need,

  • An Azure account (you can create your account for free here)
  • A Computer Vision Resource in your Azure account

To create a Computer Vision Resource, you can navigate through the portal, create a new resource and go under the class of “AI+Machine Learning”. Then select the Face Cognitive Service and set the required information.

Under the Resource Management tab you will find “Keys and Endpoint”. From this section, copy one of the two Keys and the Endpoint and paste it somewhere safe. We will be using these in the config.json file.

For detailed instructions click here.

Setup

To get a local copy of the project and run it, follow these steps.

  1. Create a folder in which you want set up the project. Go into that folder and check if python is installed.
mkdir myFolder
cd myFolder
python --version
  1. Clone the repository:
git clone https://github.com/ashavijit/Face-Find.git

3. Create a virtual environment to install dependencies in and activate it:

```sh
python -m venv venv
source venv/bin/activate
  1. Then install the dependencies:
cd FaceFind
pip install -r requirements.txt
  1. Enter your API KEY, ENDPOINT that we got from Getting API credentials, EMAIL ID and EMAIL PASSWORD in config.json
{
  "KEY": "Your Azure API KEY",
  "ENDPOINT": "Your Azure Endpoint",
  "EMAIL-ID": "Your Email ID from which the app will contact is missing person is found",
  "EMAIL-PASSWORD": "Password for said Email ID"
}

To allow the app access your email account, go to google account setting , security tab and ensure that you have Less secure app access turned on.

  1. Go to msengage\settings.py and change line number 18 as,
# Change to False if cloning and running on local host
IS_DEPLOYED_ON_HEROKU =  False
  1. Apply migrations:
python manage.py migrate
  1. Create admin account :
python manage.py createsuperuser

Follow the promt and enter the username, preferably "admin", desired email and password. Make note of the username and password as you will have to use these credentials to login.

  1. Run server:
python manage.py runserver

The app is now running at http://127.0.0.1:8000/

(back to top)

Business Logic

businessArchitecture

(back to top)

Tech Architecture

techArchitecture

(back to top)

Details of Match Found

detailsOfMatchFound

Email Received

emailReceived

(back to top)

Discussions

  • Face Detection

    • To detect the face in the image the person uploads, we use the Detect With Stream API.

    • In people\views.py we have a function generate_face_id that uses the Detect With Stream API to get the faceID, which is an identifier of the face feature and will be used in Face - Find Similar.

    # function to generate face_id using Azure Face API
    
    def  generate_face_id(image_path):
      face_client =  FaceClient(config['ENDPOINT'], CognitiveServicesCredentials(config['KEY']))
      response_detected_face = face_client.face.detect_with_stream(
      image=open(image_path, 'rb'),
      detection_model='detection_03',
      recognition_model='recognition_04',
    )
    return response_detected_face
  • Face Recognition

    • Given query face's faceID, to search the similar-looking faces from a faceID array, which is an array of faceIDs generated from Detect With Stream API, we use the Face - Find Similar API.

    • In people\views.py we have a function find_match that uses this API to find a match for the reported person from the list of missing people faceIDs.

    # function to find a match for the reported person from the list of missing people using Azure Face API
    def  find_match(reported_face_id, missing_face_ids):
      face_client =  FaceClient(config['ENDPOINT'], CognitiveServicesCredentials(config['KEY']))
      matched_faces = face_client.face.find_similar(
      face_id=reported_face_id,
      face_ids=missing_face_id
    )
    return matched_faces
  • Given the timeframe for this project and the fact that I was using a free account with limited number of API calls, I have built my MVP with these two APIs.

  • In the future I plan to make use of a faceListId instead of the faceID array for the Face - Find Similar API.

  • The major difference between these two is that faceID array contains the faces created by Face - Detect With Url or Face - Detect With Stream, which will expire at the time specified by faceIdTimeToLive after creation, which is about 86400 seconds (24 hours) by default. A faceListId is created by FaceList - Create containing persistedFaceIds that will not expire.

  • Furthermore, one could also use PersonGroup / LargePersonGroup and Face - Identify when the face number is large, the LargeFaceList can support up to 1,000,000 faces.

(back to top)

Lessons Learnt

lessonsLearnt

(back to top)

Future Work includes

  • Future plans include,

  • SMS verification for registering a missing person

  • Geo location from IP address while reporting suspected missing person.

  • Using Azure's PersonGroup / LargePersonGroup and Face - Identify for face detection and identification.

  • Sanitizing traffic to prevent API throttling.

(back to top)