Skip to content

Ch1L1/bachelor_thesis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Overview

This repository contains the Python scripts developed for a bachelor thesis project focused on face liveness detection. The project aims to utilize various image processing and machine learning techniques to reliably detect live faces in real-time video feeds. Each script in this repository performs specific functions that contribute to the overarching goal of enhancing face liveness detection accuracy and efficiency.

Scripts and Their Functions

1. Face Detection (face_detection.py)

Detects faces in real-time video feeds using a YOLOv8 model and saves the cropped face images. This is the central script for face liveness detection. After installing the required dependencies, users need to run only this script to activate the face detection functionality. No additional scripts or setup are necessary.

  • Requirements: os, numpy, cv2, ultralytics (YOLO), time, dlib, pathlib

2. Data Augmentation (data_augumentation.py)

Enhances a dataset by applying a series of image transformations to increase variability, including random rotations and brightness adjustments.

  • Requirements: os, imgaug, pathlib, imageio

3. Feature Extraction for Faces (feature_extraction.py)

Extracts detailed facial features for recognition or analysis tasks using pre-trained models.

  • Requirements: numpy, cv2, dlib

4. Edge Detection (edge_detector.py)

Implements the Hough Line Transform method to detect lines in images.

  • Requirements: cv2, numpy

5. SVM Classifier for NUAA Dataset (NUAA_SVM_classifier.py)

Classifies images using PCA-transformed features with an SVM classifier, focusing on color spaces combined features.

  • Requirements: numpy, joblib, os

Development Scripts (/src/dev)

The /src/dev directory contains additional scripts and tools used during the development of this project. These include experimental and utility scripts that are not necessary for the main functionality of the application but were crucial during the developmental stages.

1. Confusion Matrix Plotter (confusion_matrix.py)

Generates and visualizes confusion matrices for classification results, primarily useful for assessing model performance.

2. Face Normalization (normalize_face.py)

Normalizes face images by aligning and scaling them to a standard format, improving the consistency of input data for facial recognition systems.

3. Edge Detection Test (test_edge_detection.py)

Applies edge detection to images, utilizing techniques such as Canny edge detection and other algorithms.

4. Local Binary Patterns (lbpFeature.py)

This script is adapted from Adrian Rosebrock’s tutorial on LBP with OpenCV, focusing on the practical application and visualization of LBP. The script includes functionality to display the original grayscale image, the transformed LBP image, and the histogram of LBP values.

Running the Scripts

To run these scripts, ensure you have Python installed along with the necessary libraries. Each script can be executed individually via the command line. To initiate a script, use the following command:

python <script_name>.py

For face liveness detection, run the face_detection.py script. This is the primary script and does not require running any other scripts or additional setup post-installation of the required libraries. Simply execute the script as follows to start the face detection process:

python face_detection.py

Installation of Dependencies

You can install all required dependencies using pip:

pip install -r requirements.txt

Instructions for Model Installation

YOLOv8 Model (yolov8n-face.pt):

Download the YOLOv8 model file from the official repository or source:

https://github.com/noorkhokhar99/face-detection-yolov8

Dlib Shape Predictor (shape_predictor_5_face_landmarks.dat):

Download the .dat file and store it in your project directory where the scripts can easily access it:

https://github.com/justadudewhohacks/face-recognition.js-models/blob/master/models/shape_predictor_5_face_landmarks.dat

Author

Tomáš Homola

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors