← Back to Projects

Real-Time Facial Recognition & Liveness Detection System

End-to-end machine learning computer vision pipeline featuring MobileNetV2 deep learning transfer model, multi-person registration, anti-spoofing eye-blink liveness checks, and automated attendance logging.

P
Prathmesh Chavan AI Engineer • August 2026
GitHub Repository ↗

System Architecture & Anti-Spoofing Pipeline

The Facial Recognition system is engineered to run at high frame rates (25+ FPS) on standard webcams and edge devices such as Raspberry Pi. It incorporates a multi-stage verification pipeline to ensure registered identity authenticity.

Liveness Anti-Spoofing Engine

Protects against photo/video print attacks using eye blink Eye Aspect Ratio (EAR) tracking, frame-to-frame motion variance, and spatial texture artifact analysis before triggering model inference.

MobileNetV2 Classification Engine

Uses lightweight MobileNetV2 transfer learning trained on augmented facial datasets. Includes confidence scoring thresholding (0.75+) to reject unrecognized visitors.

System Execution Pipeline:
[Live Camera Stream (640x480)] ──► [OpenCV Face Detector (Haar Cascade)]
                                                 │
                                                 ▼
                              [Liveness Verification Pipeline]
                               • Eye Aspect Ratio (Blink EAR)
                               • Motion Vector & Texture Check
                                                 │
                                        (PASS Liveness)
                                                 ▼
                              [MobileNetV2 Facial Feature Extractor]
                                                 │
                                                 ▼
                              [Softmax Classifier & Confidence Check]
                                                 │
                                       (Confidence >= 0.75)
                                                 ▼
                              [SQLite Database & Attendance Logger]
                               • Log timestamped entry to CSV/Excel
                               • 30-sec duplicate suppression filter
                    

Key Capabilities

  • Real-time High FPS Detection: 25-30 FPS live performance with minimal latency (15-25ms detection, 30-50ms recognition).
  • Anti-Spoofing Liveness Verification: Prevents photo and smartphone screen replay attacks using eye aspect ratio tracking and texture analysis.
  • Automatic Data Augmentation: Automatically enhances user registration images with random rotation (±15°), contrast variation, and brightness jitter.
  • Automated Attendance Tracking: Exports timestamped attendance logs to CSV and Excel formats with duplicate filtering (30s window).
  • Raspberry Pi Optimization: ARM-optimized TensorFlow builds supporting 640x480 resolution streams at low power draw.

Project Directory Structure

Facial-recognition-system/
├── data/                      # Face image datasets & SQLite database
│   └── face_database.db
├── models/                    # Saved MobileNetV2 Keras models (.h5)
│   └── face_recognition_model.h5
├── src/                       # Python modular backend
│   ├── gui_app.py            # Desktop Tkinter GUI application
│   ├── face_detection.py     # OpenCV face detection module
│   ├── face_recognition.py   # MobileNetV2 transfer learning engine
│   ├── liveness_detection.py # EAR blink tracking anti-spoofing
│   ├── attendance_logger.py  # CSV/Excel attendance exporter
│   └── performance_logger.py # Real-time FPS & timing metrics
└── config.json               # Model parameters & thresholds
                

Technology Stack

Python 3.11 TensorFlow 2.15 MobileNetV2 OpenCV 4.8 SQLite dlib Tkinter Raspberry Pi