Skip to content

Latest commit

 

History

History
157 lines (111 loc) · 8.1 KB

README.md

File metadata and controls

157 lines (111 loc) · 8.1 KB

🖼️ Face Recognition Project

This project uses Flask, FastAPI, DeepFace, and MongoDB to create a face recognition system. It allows users to register faces with associated metadata, update their information, and delete their data.

Python application CodeQL codecov Quality Gate Status Bugs Code Smells Duplicated Lines (%) Lines of Code Security Rating Sqale Rating Sqale Index Reliability Rating Vulnerabilities

Face Recognition Dashboard

📚 Table of Contents

  1. Project Overview
  2. Get Started
  3. Project Structure
  4. Database Schema
  5. Function Flow
  6. Testing
  7. License

📂 Project Overview

This project is a facial recognition system designed for employee management using FastAPI, Flask, and MongoDB. The application allows for:

  • Storing employee details along with facial embeddings in a MongoDB database.
  • Managing employees through an easy-to-use API interface with functionality for creating, reading, updating, and deleting face entries.
  • Integrating both FastAPI (for API operations) and Flask (for front-end operations) into a seamless web application.
  • Efficient face detection and recognition using state-of-the-art machine learning techniques.

Key Features:

  • Facial Recognition: Extract and store facial embeddings from uploaded images.
  • Employee Management: Add, update, and delete employee data along with their associated images.
  • Database Storage: Store and retrieve data securely using MongoDB.
  • API Integration: Provide an API interface to interact with the data.
  • Testing: Use Pytest for testing and ensuring the application's reliability.

This application is built with the intent of simplifying employee data management, using facial recognition as the core identification method, ensuring efficiency and security. Whether you're adding a new employee or updating an existing one, this system provides a simple, robust, and scalable solution for managing employee records with facial data.

🚀 Get Started

These instructions will get you a copy of the project up and running on your local machine for development.

📋 Prerequisites

This project requires Python 3.7 or later.

📥 Installing

  1. Clone this repository to your local system using the link:

    git clone https://github.com/Devasy23/FaceRec.git
  2. Navigate to the project directory:

    cd FaceRec
  3. Install the required packages:

    pip install -r requirements.txt

🏁 Running the Server

To start Flask and FastAPI, run the following command:

python main.py

📂 Project Structure

Directory/File Description
requirements.txt Contains the Python dependencies for the project.
API/ Contains code for the FastAPI application.
FaceRec/ Contains all files for the HTML, CSS, and Flask applications.
main.py Contains code to start FastAPI and Flask together.

🗄️ Database Schema

Create a new connection in MongoDB and connect using the following URL:

URL: mongodb://localhost:27017/8000

Create the database using:

  • Database Name: DatabaseName
  • Collection Name: CollectionName

Add data by importing the JSON file from the database.mongo folder:

{DatabaseName}.{CollectionName}.json

🗄️ Database Schema

The database contains a faceEntries collection with the following schema:

Field Description
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 person.
time The time the face entry was created.
embeddings The embeddings of the face image.
Image Base64 encoded image file.

🔄 Function Flow

  1. 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.

  2. Data(): This function sends a GET request to the /data endpoint of the FastAPI app to get the list of Face Entries from MongoDB.

  3. update(): This function is used to update the details of the face entry in the database.

  4. read(): This function sends a GET request with a specific Employeecode to read the information related to that particular Employeecode.

  5. delete(): This function deletes specific employee data.

🧪 Testing

To run the tests, use the following command:

pytest

📜 License

This project is licensed under the APACHE License - please look at the LICENSE file for details.