Skip to content

About

Face Recognition that work when with masks,hats,glassed

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

🎭 Real-Time Face Recognition (Occlusion-Robust)

A robust, real-time face recognition system designed to accurately identify individuals even under real-world occlusions such as masks, hats, and glasses.

Powered by InsightFace (ArcFace) for state-of-the-art embedding extraction, OpenCV for low-light enhancement, and an optimized Gradio UI for zero-lag live video streaming.


🔥 What Makes This Stand Out

Most basic face recognition projects break when faces are partially covered or under poor lighting. This project addresses those edge cases:

Feature Standard Face Recognition This Project
😷 Mask Detection ❌ Fails ✅ Robust to masks
👓 Accessories ❌ Struggles ✅ Handles hats and glasses
⚡ Video Speed 🐢 Laggy (Blocks on inference) ✅ Real-time (Async Background Inference)
💡 Lighting ❌ Fails in shadows ✅ CLAHE low-light enhancement
📊 Accuracy 📉 Basic Haar Cascades / HOG ✅ Deep Learning (buffalo_l model)

🏗️ System Architecture

To achieve zero-lag real-time video streaming, the application uses an asynchronous background inference pipeline:

  1. Live UI Stream: The Gradio web interface captures frames at 15 FPS without queuing (queue=False), avoiding backlog buildup.
  2. Background Inference Thread: An independent worker thread runs the heavy InsightFace deep learning model on downscaled frames.
  3. Instant Annotation: The UI thread instantly draws the last known bounding boxes on the current live frame, ensuring smooth video playback regardless of GPU/CPU speed.
  4. Embedding Caching: Embeddings are loaded into memory and cache-invalidated only via timestamp, preventing disk I/O bottlenecks.

🛠️ Tech Stack

  • Deep Learning: insightface (ArcFace / buffalo_l model), onnxruntime
  • Computer Vision: opencv-python, CLAHE lighting enhancement
  • Vector Search: scikit-learn (Cosine Similarity)
  • Web Interface: gradio (v4+ compatible)
  • Deployment: Configured for Render.com (render.yaml)

🚀 Getting Started

1. Clone the repository

git clone https://github.com/snehithmthomas/Face-Recognition.git
cd Face-Recognition

2. Install dependencies

pip install -r requirements.txt

3. Run the application

python app.py

The Gradio web interface will launch locally at http://127.0.0.1:10000.


💡 How to Use

  1. Register Face (Tab 1): Enter a person's name and upload 1 or more clear photos of their face.
  2. Live Recognition (Tab 2): Allow webcam access. The system will track and recognize registered faces in real-time.

👤 Author

Snehith M Thomas

About

Face Recognition that work when with masks,hats,glassed

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages