This project uses Flask, FastAPI,DeepFace and MongoDB to create a Face recognition system. It allows users to register face with associated metadata, update their information and also can delete their data.
These instructions will get you a copy of the project up and running on your local machine for development.
This project requires Python 3.7 or later.
-
Clone this repository to your local system using link
git clone https://github.com/Devasy23/FaceRec.git
-
Navigate to the project directory:
cd FaceRec
-
Install the required packages:
pip install -r requirements.txt
To start FLask and FastAPI, run the given command:
python main.py
requirements.txt
: Contains the Python dependencies for the project.API/
: Contains code of FastAPI application.FaceRec/
: Contain all files of HTML,CSS and flask application.main.py
: Contains code of to start FastAPI and flask together.
-
Create new connection in MongoDB and Connect using given url
URL: mongodb://localhost:27017/8000
-
Create database using Database name:
DatabaseName
Collection name:CollectionName
-
Add data by importing json file: From 'database.mongo' folder ->
{DatabaseName}.{CollectionName}.json
The database contains a faceEntries
collection with the following schema:
id
: A unique identifier for the face entry.Employeecode
: A unique employee ID associated with the image.Name
: The name of the person in the image.gender
: The gender of the person.Department
: The department of the persontime
: The time the face entry was created.embeddings
: The embeddings of the face image.Image
: Base64 encoded image file.
-
create_new_faceEntry()
: This function receives a POST request with an image and metadata. It extracts the face from the image, calculates the embeddings, and stores the data in the database. -
Data()
: This function sent a GET request to/data
endpoint of FastAPI app to get the list of Face Entries from MongoDB. -
update()
:This function is used to update the details of the face entry in the database. -
read()
: This function sent a GET request with specific Employeecode to read the information related to that particular Employeecode. -
delete()
: This function is used to delete the specific Employee Data.
This project uses Flask, FastAPI,DeepFace and MongoDB to create a Face recognition system. It allows users to register face with associated metadata, update their information and also can delete their data.
These instructions will get you a copy of the project up and running on your local machine for development.
This project requires Python 3.7 or later.
-
Clone this repository to your local system using link
git clone "https://dev.azure.com/tmspl/FaceRec/_git/FaceRec-Employee-Enrollment.python"
-
Navigate to the project directory:
cd FaceRec
-
Install the required packages:
pip install -r requirements.txt
To start FLask and FastAPI, run the given command:
python main.py
requirements.txt
: Contains the Python dependencies for the project.API/
: Contains code of FastAPI application.FaceRec/
: Contain all files of HTML,CSS and flask application.main.py
: Contains code of to start FastAPI and flask together.
-
Create new connection in MongoDB and Connect using given url
URL: mongodb://localhost:27017/8000
-
Create database using Database name:
DatabaseName
Collection name:CollectionName
-
Add data by importing json file: From 'database.mongo' folder ->
{DatabaseName}.{CollectionName}.json
The database contains a faceEntries
collection with the following schema:
id
: A unique identifier for the face entry.Employeecode
: A unique employee ID associated with the image.Name
: The name of the person in the image.gender
: The gender of the person.Department
: The department of the persontime
: The time the face entry was created.embeddings
: The embeddings of the face image.Images
: Base64 encoded image file.
-
create_new_faceEntry()
: This function receives a POST request with an image and metadata. It extracts the face from the image, calculates the embeddings, and stores the data in the database. -
Data()
: This function sent a GET request to/data
endpoint of FastAPI app to get the list of Face Entries from MongoDB. -
update()
:This function is used to update the details of the face entry in the database. -
read()
: This function sent a GET request with specific Employeecode to read the information related to that particular Employeecode. -
delete()
: This function is used to delete the specific Employee Data.
To run the tests, use the following command:
pytest
This project is licensed under the APACHE License - see the LICENSE file for details.