FaceID-verification is a real-time face identification system built with Python and OpenCV. It combines DNN-based face detection (ResNet SSD) with LBPH recognition to identify known users, reject unknown individuals, and handle no-face scenarios from a live webcam stream.
FaceID-verification is a real-time face identification and verification system built with Python and OpenCV. The application detects a face from a live webcam stream, extracts facial features, and identifies whether the detected person belongs to a set of known individuals or should be classified as an unknown user.
The system supports three decision states:
- Known person detected (e.g., Tomas, Anne)
- Unknown person detected
- No face detected
Additionally displays real-time confidence (distance) evaluation
Positive verification: I was properly detected
How It Works
- A live video stream is captured from the webcam.
- A Deep Neural Network (DNN) face detector (ResNet SSD) identifies faces in the frame.
- The detected face is cropped, normalized (grayscale, resized to 200×200), and passed to the recognizer.
- An LBPH (Local Binary Patterns Histograms) model predicts the closest matching identity.
- A threshold-based decision layer determines:
- If the face matches a known identity
- If the face should be classified as Unknown
- If no face is present
Positive verification: My friend was properly detected
The system performs 1:N identification with rejection capability:
- If no face is detected →
"No face detected" - If face is detected:
- Predict
(label, confidence) - If
confidence < threshold→ Known identity - If
confidence ≥ threshold→"Unknown person"
- Predict
This approach prevents forced classification and introduces a practical identity rejection mechanism.
face_unlock/
│
├── data/
│ ├── dataset/
│ │ ├── Tomasz/
│ │ └── Ania/
│ └── model/
│
├── models/
│ ├── deploy.prototxt
│ └── res10_300x300_ssd_iter_140000.caffemodel
│
├── src/
│ ├── collect.py
│ ├── train.py
│ ├── recognise.py
│ └── face_utils.py
│
└── README.md
- collect.py – captures and stores training data
- train.py – trains the LBPH model and saves it to disk
- recognise.py – performs real-time face identification
- face_utils.py – handles DNN-based face detection
The project follows a modular structure to ensure maintainability and scalability.
OpenCV plays a critical role in two stages:
The system uses OpenCV's DNN module with a pre-trained ResNet SSD model:
blob = cv2.dnn.blobFromImage( cv2.resize(frame, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0) ) net.setInput(blob) detections = net.forward()
This deep learning–based detector locates faces in each video frame with higher robustness to lighting and slight pose variations compared to traditional Haar cascades.
The LBPH recognizer is used for identity classification:
model = cv2.face.LBPHFaceRecognizer_create() model.train(faces, labels) label, confidence = model.predict(face)
LBPH encodes facial texture into local binary patterns and compares histogram distances to identify faces using a confidence threshold.
pip install opencv-python opencv-contrib-python numpy
Collect face samples for each person:
python src/collect.py --name Tomas python src/collect.py --name Anne
Images will be stored under:
data/dataset/<PersonName>/
python src/train.py
This generates:
data/model/model.xml
data/model/labels.pkl
python src/recognise.py
Possible outputs:
- Detected: Tomas
- Detected: Anne
- Unknown person
- No face detected
This project demonstrates:
- Real-time computer vision processing
- Deep learning model integration (OpenCV DNN)
- Face recognition pipeline design
- Threshold-based decision systems
- Modular architecture and model persistence
- Practical identity verification logic
It represents a complete end-to-end computer vision application suitable for authentication, access control, and embedded identity systems.


