Giter Club home page Giter Club logo

face-recognition-api's Introduction

Face Recognition Service using FastAPI

This is a simple Face Recognition Service implemented using FastAPI, MongoDB or SQLite, and FaceNet model for face recognition.

Getting Started

Prerequisites

  • Python 3.9 or later.
  • A MongoDB instance or SQLite database.
  • Environment variable configuration file .env.

Installing

Clone the repository:

git clone https://github.com/eren23/face-recognition-api.git cd repository

Install dependencies:

pip install -r requirements.txtv

Running the Application

The application can be started with the following command:

uvicorn main:app --reload

The --reload flag enables hot reloading which means the server will automatically update whenever you make changes to your code.

Configuration

The service can use either MongoDB or SQLite for storing embeddings, this can be configured using the DB_CHOICE environment variable in the .env file:

DB_CHOICE=mongo

or

DB_CHOICE=sqlite

The connection string for the MongoDB instance is taken from the MONGO_CONNECTION_STRING environment variable in the .env file:

MONGO_CONNECTION_STRING=yourconnectionstring

Remember to replace the connection string with your own.

Endpoints

The service exposes two endpoints:

  • POST /add_face/{user_id}: Add a new face to a user. The user is identified by user_id and the face is passed in the form of an uploaded image file. The service will extract the face embedding from the image and store it in the database associated with the user.

  • POST /identify_face/: Identify a face in an uploaded image. The service will extract the face embedding from the image and compare it with the embeddings stored in the database. If a match is found, it returns the user_id associated with the match.

face-recognition-api's People

Contributors

eren23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

edwinkestler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.