Skip to content

TheValiant/RecognAIze

Repository files navigation

RecognAIze

Employee face recognition system using traditional computer vision techniques. Built for the Kaggle "Identify Employees in Surveillance CCTV" hackathon.

Overview

RecognAIze is a lightweight face recognition pipeline that processes surveillance camera frames to identify employees without requiring GPU hardware or deep learning frameworks. It uses:

  • Haar cascade classifiers for face detection
  • Traditional CV features (HOG, LBP, raw pixels, statistical moments) for embeddings
  • Cosine similarity matching with employee prototypes
  • Configurable thresholds for unknown face handling

Architecture

Input Image → Face Detection → Feature Extraction → Embedding → Similarity Matching → Employee ID
     ↓              ↓               ↓              ↓            ↓
   OpenCV      Haar Cascade    HOG + LBP +     PCA      Cosine Similarity
                              Raw Pixels +  Reduction    with Prototypes
                              Moments

Installation

git clone https://github.com/TheValiant/RecognAIze.git
cd RecognAIze
pip install -r requirements.txt
pip install -e .

Requirements:

  • Python 3.8+
  • OpenCV (opencv-python)
  • scikit-learn
  • NumPy

Quick Start

Run Complete Pipeline

from src.face_recognition.inference.test_inference import TestInferencePipeline

pipeline = TestInferencePipeline(
    dataset_root="path/to/dataset",
    similarity_threshold=0.6
)

output_files = pipeline.run_complete_inference(
    min_confidence=0.4,
    save_debug=True
)

Process Individual Components

from src.face_recognition.detection.detector import FaceDetector
from src.face_recognition.embedding.embedder import FaceEmbedder
import cv2

# Initialize
detector = FaceDetector()
embedder = FaceEmbedder()

# Detect and embed
image = cv2.imread("image.jpg")
faces = detector.detect_faces(image, min_confidence=0.5)

for face_data in faces:
    face_result = detector.extract_face(image, face_data)
    embedding = embedder.compute_embedding(face_result['face'])

Dataset Structure

dataset/
├── reference_faces/           
│   ├── emp001/               
│   │   ├── image1.jpg
│   │   └── image2.jpg
│   └── emp002/
│       └── image1.jpg
├── train/
│   ├── images/               
│   └── labels.csv           
└── test/
    └── images/              

Configuration

Face Detection

detector_config = {
    'scale_factor': 1.1,
    'min_neighbors': 5,
    'min_size': (30, 30),
    'max_size': (300, 300)
}

Similarity Matching

matcher_config = {
    'similarity_threshold': 0.6,
    'aggregation_method': 'mean',
    'min_faces_per_employee': 1
}

Performance

  • Processing Speed: ~0.1-0.2 seconds per image on CPU
  • Memory Usage: ~100-200MB for full pipeline
  • Face Detection Rate: ~50-70% on surveillance-quality images

Trade-offs:

  • Fast setup with no model downloads
  • Low resource usage - works on basic hardware
  • Deterministic results
  • Lower accuracy than deep learning approaches
  • Sensitive to lighting conditions

Testing

python tests/run_tests.py

Test suite covers:

  • Face detection functionality
  • Embedding generation
  • Similarity matching
  • Pipeline integration

Project Structure

RecognAIze/
├── src/face_recognition/
│   ├── detection/          # Face detection module
│   ├── embedding/          # Feature extraction
│   ├── inference/          # Similarity matching and pipelines
│   └── utils/              # Utilities and data loading
├── tests/                  # Unit tests
├── main.py                 # Entry point
├── validate_system.py      # Validation utilities
└── optimize_system.py      # Hyperparameter optimization

Limitations

This is a traditional computer vision approach designed for educational purposes and rapid prototyping. For production security systems, consider:

  • Deep learning models (FaceNet, ArcFace, VGGFace2)
  • Advanced detection (MTCNN, RetinaFace)
  • GPU acceleration for batch processing

License

MIT License - see LICENSE for details.

About

Face recognition system using traditional computer vision (Haar cascades, HOG, LBP descriptors)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages