Skip to content

GRUMPY-TUCKER/Face_Recognition_ComputerVision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

🧑‍💻 Face_Recognition_ComputerVision

A compact, easy-to-follow repository for experimenting with face detection and face recognition using classical computer vision and (optionally) deep learning approaches. This project collects utilities, example notebooks/scripts, and training/evaluation guidance so you can go from images ➝ working face recognition pipeline quickly.


⚡ TL;DR

✅ Detect faces in images and video (Webcam / file) ✅ Extract face embeddings and perform recognition/verification ✅ Train / evaluate a simple recognition model or use pretrained embeddings ✅ Example scripts and notebooks included for quick experimentation


📑 Table of Contents

  • 🔎 Project overview
  • ✨ Features
  • 🚀 Quick demo
  • 📦 Requirements
  • ⚙️ Installation
  • 📂 Repository layout
  • 🖼️ Dataset format / preparing your data
  • 🏋️ Training (optional)
  • 🖥️ Inference / Usage
  • 📊 Model evaluation
  • 🛠️ Tips & troubleshooting
  • 🤝 Contributing
  • 🙏 Acknowledgements / References
  • 📧 Contact

🔎 Project overview

This repository aims to be a hands-on toolkit for learning and prototyping face recognition systems.

It demonstrates a typical pipeline:

  1. 👀 Face detection (OpenCV Haar/Cascade, DNN, or MTCNN)
  2. ✨ Alignment & preprocessing
  3. 🧬 Feature extraction (classical descriptors or deep embeddings)
  4. 🎯 Classification / similarity matching (SVM, KNN, cosine similarity, or neural nets)

✨ Features

  • 🖼️ Face detection scripts (images & webcam)
  • ⚡ Preprocessing & alignment helpers
  • 🔗 Embedding extraction (using face_recognition, TensorFlow, or PyTorch models)
  • 🤖 Simple recognition with KNN / SVM / cosine similarity
  • 📓 Example notebooks & configs
  • 📊 Evaluation utilities (accuracy, confusion matrix)

🚀 Quick demo

# 1. Detect faces in an image
python scripts/detect_faces.py --input examples/group_photo.jpg --output examples/group_photo_out.jpg

# 2. Extract embeddings
python scripts/extract_embeddings.py --dataset data/images --output data/embeddings.pkl

# 3. Train recognizer
python scripts/train_recognizer.py --embeddings data/embeddings.pkl --model models/recognizer.pkl

# 4. Recognize face from image
python scripts/recognize_image.py --image examples/person1.jpg --model models/recognizer.pkl

📦 Requirements

  • 🐍 Python 3.8+

  • 📚 Libraries:

    • numpy, scikit-learn, pandas
    • opencv-python
    • face_recognition (optional, uses dlib)
    • dlib (requires CMake + compiler)
    • tensorflow or torch (if deep models included)
    • imutils, matplotlib

💡 GPU recommended for training deep models but not required.


⚙️ Installation

# 1. Clone repo
git clone https://github.com/GRUMPY-TUCKER/Face_Recognition_ComputerVision.git
cd Face_Recognition_ComputerVision

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate    # Mac / Linux
venv\Scripts\activate       # Windows

# 3. Install dependencies
pip install -r requirements.txt

📂 Repository layout

scripts/
 ├─ detect_faces.py
 ├─ extract_embeddings.py
 ├─ train_recognizer.py
 ├─ recognize_image.py
 └─ recognize_video.py
notebooks/
 └─ demo.ipynb
data/
 ├─ images/     # training images
 └─ test/       # validation images
models/
 ├─ embeddings/
 └─ recognizer.pkl
utils/
 ├─ preprocessing.py
 └─ visualization.py
examples/
 └─ sample images
requirements.txt
README.md

🖼️ Dataset format / preparing your data

data/images/
 ├─ person_1/
 │   ├─ img001.jpg
 │   └─ img002.jpg
 ├─ person_2/
 │   ├─ img001.jpg
 │   └─ img002.jpg

✅ Tips:

  • Collect multiple images per person with varied lighting, poses, backgrounds.
  • Ensure face detector works well before training.
  • For large datasets, maintain a CSV/JSON index mapping.

🏋️ Training (optional)

# Step 1: Extract embeddings
python scripts/extract_embeddings.py --dataset data/images --detector hog --output data/embeddings.pkl

# Step 2: Train classifier
python scripts/train_recognizer.py --embeddings data/embeddings.pkl --model models/recognizer.pkl --method svm

# Step 3: Evaluate model
python scripts/evaluate.py --model models/recognizer.pkl --test data/test

🖥️ Inference / Usage

# Single image recognition
python scripts/recognize_image.py --image examples/test.jpg --model models/recognizer.pkl

# Realtime recognition (webcam)
python scripts/recognize_video.py --model models/recognizer.pkl --source 0

📊 Evaluation

  • ✅ Accuracy
  • ✅ Precision / Recall / F1
  • ✅ ROC / AUC
  • ✅ Confusion matrix

🛠️ Tips & Troubleshooting

⚠️ No faces detected? → Try another detector (HOG / CNN / MTCNN) ⚠️ dlib install issues? → Install CMake + compiler (VS Build Tools on Windows) ⚠️ Slow on CPU? → Resize images or use GPU-enabled models ⚠️ Low accuracy? → Improve dataset quality, tune classifier, or use better embeddings


🤝 Contributing

  • Fork the repo 🍴
  • Create a new branch 🌱
  • Add your changes + tests ✅
  • Submit a pull request 🔄

🙏 Acknowledgements / References

  • dlib
  • OpenCV
  • FaceNet, ArcFace and related academic works

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages