Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Real-Time Face Recognition & Analysis System

A comprehensive computer vision project that performs real-time Face Detection, Identity Recognition, Emotion Analysis, and Gender Classification using a webcam feed.

The system combines MediaPipe , dlib/face_recognition , and TensorFlow/Keras.

Features

  • Multi-Task Analysis: Simultaneously predicts Identity, Emotion, and Gender for every face in the frame.
  • High-Performance Detection: Uses Google's MediaPipe for ultra-fast face tracking, even on CPU.
  • Dynamic Database: Add new faces to the database instantly while the program is running.
  • Persistent Storage: Automatically saves and loads known face encodings from known_faces.pkl.
  • Stats Tracking: Keeps track of how many times each known person has been seen.

Prerequisites

  • Python 3.10 or 3.11 (Recommended).
    • Note: Python 3.12+ is currently incompatible with some TensorFlow/dlib features.
  • Visual Studio C++ Build Tools (Required for Windows users to compile dlib).
  • Webcam

Project Structure

├── **Standard Version**
├── FaceRecognitionV2.py      # Main application script
├── requirements.txt          # Python dependencies
├── known_faces.pkl           # Database of registered face encodings
├── emotionModel.hdf5         # Pre-trained Keras model for Emotion detection (48x48)
├── genderModel.hdf5          # Pre-trained Keras model for Gender detection (64x64)
└── face_recognition_output/  # Directory where saved face images are stored

Set Up a Virtual Environment

It is highly recommended to use a clean virtual environment to avoid version conflicts.

Windows:

Bash
python -m venv venv
.\venv\Scripts\activate

Mac/Linux:

Bash
python3 -m venv venv
source venv/bin/activate

Controls:

The webcam feed will open automatically.

Press s: Save the current face to the database. You will be prompted in the terminal to type a name.

Press q or Esc: Quit the program.

Install Dependencies

Critical Step: If you are on Windows, ensure you have installed the "Desktop development with C++" workload via Visual Studio Build Tools before running this.

Bash
pip install -r requirements.txt

Fix Version Conflicts (Important)

TensorFlow and dlib often conflict with the newest Numpy versions. Downgrade Numpy to ensure stability:

Bash
pip install "numpy<2"

About

Face Recognition Project using OpenCV , Mediapipe for live recognition with Gender recognition and Emotion detection using Simple CNN.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages