Click to Expand
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.
- 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
Click to Expand
Purpose: Accepts base64 image from a browser form and compares it with stored student images.
Usage:
- Host on a CGI-enabled web server (Apache/Nginx).
- Form must send:
current_image→ Base64 string of uploaded imageemail→ student ID corresponding to stored image
- Place reference images in
students/folder named as{email}.jpg.
Note : Check Error.md file if you are facing issue.
Example flow:
Browser → Form → Base64 → Server → Compare → JS alert
Click to Expand
Purpose: Converts images to base64 internally for API-ready logic. Users only need to provide image paths.
Usage:
- Change paths:
stored_image_path = "/content/image.png"
current_image_path = "/content/image_0.jpg"-
Run the script; it automatically:
- Converts images → Base64
- Converts Base64 → temporary images
- Compares faces using
face_recognition
-
Prints Face Matched / Not Matched result
Benefits:
- No manual Base64 needed
- API-ready for Flask/FastAPI
- Works locally or in Colab
Click to Expand
Purpose: Allows testing in Google Colab using manual uploads.
Usage:
-
Open Colab notebook.
-
Run the code; it will prompt:
- Upload STORED (reference) image
- Upload CURRENT (image to verify)
-
Automatically compares faces and prints result.
Best For: Beginners, testing, and quick prototyping.
git clone https://github.com/alok-kumar8765/face_recogenize.git
cd face_recogenize
pip install -r requirements.txt- Python ≥ 3.7
- face_recognition
- dlib
- numpy
Optional (Colab):
!pip install face_recognitionClick to Expand
-
face_recognitioninstallation fails- On Windows, dlib may fail. Solution: Use Anaconda or Colab.
-
No face detected
- Ensure image contains one clear, front-facing face.
- Lighting and resolution matter.
-
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).
-
Older Python / Library versions
- Ensure
face_recognition>=1.3.0,dlib>=19.22,numpy>=1.19
- Ensure
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 🚀
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!"


