A Django Web Application to help find missing people using Face Recognition.
Now deployed on Heroku! Click here to check it out!
Table of Contents
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.
To achieve the goal of finding missing people, I made use of the following tools and languages,
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
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.
To get a local copy of the project and run it, follow these steps.
- 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
- Clone the repository:
git clone https://github.com/tinycoder2/FaceFind.git
- Create a virtual environment to install dependencies in and activate it:
python -m venv myEnv
cd myEnv
.\Scripts\activate
cd ..
- Then install the dependencies:
cd FaceFind
pip install -r requirements.txt
- 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.
- 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
- Apply migrations:
python manage.py migrate
- 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.
- Run server:
python manage.py runserver
The app is now running at http://127.0.0.1:8000/
- Landing page displaying hero section, about section, technology used and FAQ section.
home_screen.mp4
register_missing_person.mp4
report_suspected_missing_person.mp4
- Logging in as the admin and displaying site from admin POV.
admin_login_logout.mp4
- Viewing all missing people, ones that need to be approved, approving a missing person (background check), viewing missing people with status as Leads, status as Found, Deleting a missing person, Editing the details of a missing person.
missing_people_views.mp4
- Viewing all reported people, ones that need to be approved, approving a reported person (checking validity of report), viewing details of potential match, confirming the match, status of missing person changing from Leads to Found.
reported_people_views_confirmation.mp4
-
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 functiongenerate_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 functionfind_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 thefaceID 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. AfaceListId
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.
-
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.