A simple Facial recognition Grpc Service to enroll and verify faces

Dr-Swopt a757979b04 delete redudant 4 days ago
proto 1f1b5a7f78 refactor a fair bit 4 days ago
.gitignore d4454e9352 added updated readme 4 days ago
README.md d4454e9352 added updated readme 4 days ago
face_recognition_logic.py 1f1b5a7f78 refactor a fair bit 4 days ago
grpc_client.py 1f1b5a7f78 refactor a fair bit 4 days ago
requirements.txt e6df6ad535 setup 6 days ago
sample_aladdin.jpg 1f1b5a7f78 refactor a fair bit 4 days ago
server.py 1f1b5a7f78 refactor a fair bit 4 days ago

README.md

gRPC Face Recognition Service - Part 1

A Python gRPC server for face recognition and employee management using DeepFace.
This service enables you to enroll faces, recognize faces, list all employees, and delete employees efficiently.


Features

  • Face Recognition: Identify a person from an image and return the best match with confidence score.
  • Enroll Employees: Save new employee face images to the system.
  • List Employees: Retrieve a list of all enrolled employees along with their images.
  • Delete Employees: Remove an employee by name from the system.

Setup & Environment

1. Clone the Repository

git clone cd

2. Create a Python Virtual Environment

Windows (PowerShell or CMD): python -m venv venv

macOS / Linux: python3 -m venv venv

3. Activate the Virtual Environment

Windows (PowerShell): .\venv\Scripts\Activate.ps1

Windows (CMD): venv\Scripts\activate.bat

macOS / Linux: source venv/bin/activate

4. Install Dependencies

pip install grpcio grpcio-tools deepface pandas opencv-python

5. Generate gRPC Python Files (if not already present)

python -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/face_recognition.proto

6. Run the Server

python server.py

The server will start and listen on port 50051, displaying: [INFO] gRPC Face Recognition server running on port 50051


Usage Examples

Recognize a Face:
Send an image to the gRPC endpoint and receive the best matching employee with confidence score.

Enroll a New Employee:
Provide a name and image to add a new employee to the system.

List Employees:
Retrieve all employees and their associated face images.

Delete an Employee:
Remove an employee from the database by specifying their name.


Notes

  • Ensure that images are clear and well-lit for optimal face recognition accuracy.
  • The server is currently configured to run locally on port 50051. Modify server.py if a different port is required.
  • For production deployment, consider adding authentication and persistence beyond in-memory storage.

References