Skip to content

alok-kumar8765/face_recogenize

Repository files navigation

🔥 Face Recognition Pipeline

GitHub stars GitHub forks GitHub contributors GitHub last commit GitHub language


📖 Table of Contents

Click to Expand
  1. Description
  2. Features
  3. Usage
  4. Installation
  5. Requirements
  6. Known Issues / Fixes
  7. Contributing
  8. License
  9. Tags

📄 Description

This repository provides a complete face recognition pipeline using Python's face_recognition library. It supports three modes of usage:

  • Code 1: Traditional web server CGI setup (accepts base64 image via browser form)
  • Code 2: Backend-ready Base64 pipeline (convert images to Base64 internally, API-ready)
  • Code 3: Google Colab-friendly version for testing with manual uploads

The repo is designed to be modular, beginner-friendly, and easily extensible for APIs, mobile apps, and production environments.


⭐ Features

  • Face verification between stored reference image and live/current image
  • Works in web servers, Colab, and local scripts
  • Handles base64 conversion automatically for future API integration
  • Safe checks for no-face images
  • Easy for beginners: just provide image paths or upload files in Colab
  • Modular structure for future Flask/FastAPI integration

🛠 Usage

🔹 Code 1: Web Server (CGI)

Click to Expand

Purpose: Accepts base64 image from a browser form and compares it with stored student images.

Usage:

  1. Host on a CGI-enabled web server (Apache/Nginx).
  2. Form must send:
    • current_image → Base64 string of uploaded image
    • email → student ID corresponding to stored image
  3. Place reference images in students/ folder named as {email}.jpg.

Note : Check Error.md file if you are facing issue. Error File

Example flow:

Browser → Form → Base64 → Server → Compare → JS alert


🔹 Code 2: Base64 Pipeline

Click to Expand

Purpose: Converts images to base64 internally for API-ready logic. Users only need to provide image paths.

Usage:

  1. Change paths:
stored_image_path = "/content/image.png"
current_image_path = "/content/image_0.jpg"
  1. Run the script; it automatically:

    • Converts images → Base64
    • Converts Base64 → temporary images
    • Compares faces using face_recognition
  2. Prints Face Matched / Not Matched result

Benefits:

  • No manual Base64 needed
  • API-ready for Flask/FastAPI
  • Works locally or in Colab

🔹 Code 3: Google Colab Friendly

Click to Expand

Purpose: Allows testing in Google Colab using manual uploads.

Usage:

  1. Open Colab notebook.

  2. Run the code; it will prompt:

    • Upload STORED (reference) image
    • Upload CURRENT (image to verify)
  3. Automatically compares faces and prints result.

Best For: Beginners, testing, and quick prototyping.


💻 Installation

git clone https://github.com/alok-kumar8765/face_recogenize.git
cd face_recogenize
pip install -r requirements.txt

📦 Requirements

  • Python ≥ 3.7
  • face_recognition
  • dlib
  • numpy

Optional (Colab):

!pip install face_recognition

⚠ Known Issues / Fixes

Click to Expand
  1. face_recognition installation fails

    • On Windows, dlib may fail. Solution: Use Anaconda or Colab.
  2. No face detected

    • Ensure image contains one clear, front-facing face.
    • Lighting and resolution matter.
  3. Base64 pipeline errors

    • Make sure the image path exists and is readable.
    • File names should not contain parentheses (e.g., (1) may cause issues in some environments).
  4. Older Python / Library versions

    • Ensure face_recognition>=1.3.0, dlib>=19.22, numpy>=1.19

🤝 Contributing

We welcome contributions! 💡

  • Star the repo to show support ⭐
  • Fork and make changes
  • Submit pull requests with improvements
  • Report issues or bugs

Motivation: Help others easily implement face recognition in their apps 🚀


📄 License

MIT License


💡 Motivation / Notes

This repo is designed to help developers and beginners:

  • Quickly test face recognition in Colab or local machines
  • Integrate face recognition in web applications
  • Learn base64 pipelines for image handling
  • Prepare code for future REST APIs

Enjoy and contribute! 🌟

"Hit Star ⭐, contribute code, and make face recognition accessible for everyone!"

Snippet Image (Reference)

Stored Image Vs Current Image

Snippet Image

Snippet Image

About

The repo is designed to be **modular, beginner-friendly, and easily extensible** for APIs, mobile apps, and production environments.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors