Skip to content

tiwariayush/face-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Face detector

Simple face detector API using dlib using localstack to save data in S3 bucket and dynamoDB.

Overview

The project is divided into two directories.

  • ./streamer : a python script that launches your camera and detects your face.
  • ./api : a vanilla django api (with an app streamer), with Postgresql.

Requirements

  • Docker
  • Python 3.6
  • Aws cli. We do not need an AWS account for this project !

Getting started

  • First start the api : docker-compose up -d api. You may need to run the first migrations : docker-compose exec api django-admin migrate.
  • Create dynamodb table (chose a name) : aws dynamodb create-table --table-name testDB --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --endpoint-url http://localhost:4569
  • Create a S3 bucket : aws s3api create-bucket --bucket testBucket --endpoint-url http://localhost:4572
  • Make the bucket easily readable : aws s3api put-bucket-acl --bucket testBucket --acl public-read --endpoint-url http://localhost:4572

Once you've done all these steps, the API and different storage are up and running, just as if they were distant services. It is now time to look at the streamer, which is the client that will run on your machine, access the webcam and interact with the API.

Data Structure

Our goal is to save all the data generated by one session of the streamer. For each iteration of the streamer algorithm, we need to save :

  • the frame on which the streamer has run
  • the feedback returned for that frame
  • the face extracted for that frame, if there was one
  • During running of streamer, images are saved inside S3 and info on single frame iteration is saved inside dynamodb.
  • Once the streamer is done, API calls are made to create and save data as Django objects from the dynamodb data.

API:

Different API calls to get data:

  1. To get extracted faces of session with : http://localhost:8000/api/stream-sessions/<sessionId>/faces
  2. To get all streaming sessions: http://localhost:8000/api/stream-sessions/
  3. To get all frame iterations for a streaming session: http://localhost:8000/api/stream-sessions/<sessionId>/iterations

About

Basic face detector API with openCV

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages