Face Recognition

  1. Home
  2. Face Recognition

Face Recognition

A Python application for real-time face recognition from a webcam, with multiple runtime modes for different performance and camera-angle scenarios. The system uses OpenCV for video capture, on-screen rendering, and image preprocessing, while the face_recognition library powered by dlib performs face detection and computes face encodings.

The project is designed for autonomous operation: new faces automatically receive a UUID, are saved as Unknown, get an initial photo, and store their first embedding. Over time, the system can append additional encodings for the same person to improve recognition stability across angle changes, partial misses, and noisy frames.

  • Category :Computer Vision / Python
  • Stack :Python, OpenCV, face_recognition, dlib, pickle, multiprocessing
  • Modes :Offline / Real-time Webcam / Batch Photo Import
  • Data Store :known_faces.pkl + faces/<user_id>/ + logs/
  • Identity Model :UUID + auto-growing encodings
  • Controls :q / w / d
  • Status :Working Prototype / Implementation Ready

Core Features

The project has grown from a base recognizer into a small set of practical runtime modes, each focused on a different operating condition while keeping the same identity model and storage layout.

  • Base real-time mode for webcam capture, rendering, and identity tracking.
  • A multiprocessing variant moves heavy face detection into a separate process to reduce UI lag.
  • A ceiling-angle variant is tuned for tilted or top-down cameras with stronger preprocessing.
  • Folder-based photo import can build or extend the known face database offline.
  • Identity can recover by position during short embedding dropouts, then grow with new encodings.

"The goal is not only to recognize a face in a frame, but to preserve the same identity across noisy frames, missed embeddings, and changing camera angles."

Design Note - Identity Persistence

Architecture

known_faces.pkl stores person names and their face encodings. Photos are stored in faces/<user_id>/, global events are written to log.txt, and each person also has a dedicated log file. Matching is driven by face encodings first, with temporary spatial tracks and recent position used in process memory to recover identity when embeddings briefly fail. Visibility time is calculated at runtime for the current presence session, from the first frame where a person appears until that person leaves the visible zone.

Implementation Flow

  • Load known_faces.pkl and prepare runtime tracks for the current session.
  • Run webcam, low-load, or ceiling-angle mode depending on the scenario.
  • Detect faces, compute encodings, and compare them with stored profiles.
  • Recover identity by recent position when an otherwise known face is briefly missed.
  • Update the visibility timer in memory and render the name with elapsed time on screen.
  • Use w to rename an ID and d to delete the record, photos, and logs.

What Is Stored

  • known_faces.pkl stores person names and their encoding lists.
  • faces/<user_id>/main.jpg stores the main profile photo.
  • Additional face snapshots can be kept inside each user folder.
  • log.txt stores global events, with a dedicated log for each UUID.
  • Deleting an ID removes the database entry, photos, and related logs.

Related Projects

AI JARVIS

AI JARVIS

Offline Assistant / Personalization
Website Stack

Website Stack

Portfolio / Startup / Club Sites
Swarm Drones

Swarm Drones

Arduino / Swarm Intelligence

Project Summary

Send a direct message about this project and it will be delivered to my email.