Finalreport - PDF 09-23-10-114
Finalreport - PDF 09-23-10-114
On
Submitted by:
Submitted to:
Mrs.Pooja Prakash
Dr.Sanjiba Bisoyi
(Project Coordinators)
2024-25
JSS MAHAVIDYAPEETHA
JSS ACADEMY OF TECHNICAL EDUCATION, NOIDA
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
C-20/1, SECTOR – 62, NOIDA- 201301
DECLARATION
We hereby declare that the project report entitled "Face Detection and Recognition using
MATLAB" submitted to JSSATEN is an original work carried out by us under the
guidance of Ms.Pooja Prakash & Dr.Sanjiba Bisoyi. This project has not been submitted
for the award of any other degree, diploma, fellowship, or similar title or recognition.
All the information and data in this report have been acknowledged and referenced
wherever they have been obtained from other sources. The work embodies the results of
our research and has been completed to the best of our knowledge.
We understand that any violation of the above conditions may result in disciplinary action
as per the rules of the institution.
Signature:
Ananya Gupta
Devansh Agrawal
Nikita Negi
Yashi Upadhyay
Date:
26/12/2024
i
ACKNOWLEDGEMENT
We extend our heartfelt thanks to JSSATEN for providing the resources and environment
necessary to carry out this project.
Lastly, we are deeply grateful to our family and friends for their unwavering support and
understanding during this time. Their encouragement motivated us to persevere and give
our best effort.
Signature:
Ananya Gupta
Devansh Agrawal
Nikita Negi
Yashi Upadhyay
Date:
26/12/2024
ii
ABSTRACT
The project titled "Face Detection and Recognition Using MATLAB" focuses on
developing a robust system for detecting and recognizing human faces using advanced
deep learning techniques integrated with MATLAB. The system leverages Convolutional
Neural Networks (CNNs) for feature extraction and classification, utilizing pre-trained
models like GoogleNet and SqueezeNet to enhance accuracy and performance.
The methodology includes face detection using algorithms such as the Viola-Jones
method and advanced CNN-based detection frameworks. For recognition, the project
employs GoogleNet and SqueezeNet, fine-tuned for facial feature extraction and
classification tasks. MATLAB’s deep learning toolbox and image processing capabilities
are utilized to train, validate, and test the models on a curated dataset of faces.
In conclusion, this project showcases the potential of combining classical and deep
learning techniques for real-world applications such as biometric authentication,
surveillance, and human-computer interaction, setting a benchmark for further
advancements in the field.
iii
TABLE OF CONTENTS
Declaration i
Acknowledgment ii
Abstract iii
List of Figures v
1 Chapter1: Introduction 1
4 Conclusions 8
5 References 9
iv
LIST OF FIGURES
v
CHAPTER-1: INTRODUCTION
This project focuses on implementing and analyzing face detection techniques using MATLAB,
with the goal of accurately detecting and tracking human faces across various contexts. Face
detection serves as the foundation for many computer vision applications, involving the
identification and localization of faces in images and videos. By leveraging MATLAB's built-in
vision.CascadeObjectDetector, the project aims to efficiently detect faces in static images,
video files, and real-time streams, making it suitable for dynamic scenarios.
To enhance the system's capabilities, transfer learning techniques are applied for face
recognition. Pre-trained deep learning models such as GoogLeNet and SqueezeNet are utilized to
identify faces with high accuracy and minimal computational effort. GoogLeNet is known for its
efficiency and accuracy in image classification tasks, while SqueezeNet offers a lightweight
alternative with reduced memory requirements, making it ideal for resource-constrained
environments.
By combining face detection and recognition, the project develops a robust system that is
applicable in various fields, including video surveillance, security systems, and human-computer
interaction. This integration enables the system to detect and identify faces in real-time,
highlighting its potential for practical and scalable applications.
1
CHAPTER-2: FACE DETECTION
Code Explanation:
Load Image: The imread function loads an image into MATLAB.
Check and Resize: If the image width exceeds 320 pixels, imresize resizes it to ensure
consistency while maintaining aspect ratio.
Set Up Detector: The vision.CascadeObjectDetector initializes a face detection model.
Detect Faces: The step function computes face coordinates within the image.
Draw Rectangles: The insertShape function overlays rectangles on detected face locations
for visualization.
Display Results: imshow displays the processed image with highlighted faces.
2
2.2 Face Detection In Videos:
Face detection in videos involves not only identifying faces but also tracking them across
consecutive frames, a critical step for applications like video surveillance and
human-computer interaction. Unlike static image detection, video face detection must
account for movement, lighting changes, and varying angles. MATLAB facilitates this with
tools such as vision.CascadeObjectDetector for initial detection and vision.PointTracker
for continuous tracking. By combining detection and tracking, the system ensures accurate
and stable face monitoring throughout the video.
Code Explanation:
Load Video: The VideoReader function loads the video, and the initial frame is extracted
with readFrame.
Face Detection: vision.CascadeObjectDetector identifies the face region in the initial
frame.
Bounding Box and Features: Detected face locations are marked with bounding boxes and
converted to points using bbox2points.
Feature Points: Grayscale conversion and detectMinEigenFeatures extract points for
tracking.
Point Tracker Initialization: A vision.PointTracker is set up to follow feature points in
subsequent frames.
Tracking Loop:
● For each frame, feature points are tracked using step.
● Geometric transformations (estimateGeometricTransform) refine the bounding box.
● Updated bounding boxes are visualized using insertShape and insertMarker.
Video Player: vision.VideoPlayer displays the processed video with detected and tracked
faces.
3
CHAPTER-3: FACE RECOGNITION
Code Explanation:
Dataset Preparation:
● Load the dataset using imageDatastore and split it into training and validation sets
with splitEachLabel.
Network Modification:
● Analyze the GoogLeNet architecture using analyzeNetwork.
● Replace the final feature extraction layer and classifier with task-specific layers using
replaceLayer.
Data Augmentation:
● Apply transformations like scaling, flipping, and translation using
imageDataAugmenter to create augmented datasets.
● Resize images to match the network's input size using augmentedImageDatastore.
Training the Network:
● Configure training options (trainingOptions) with parameters such as batch size,
learning rate, and epochs.
● Train the modified network using trainNetwork on augmented training data.
Testing the Network:
● Define a testing function that preprocesses an image, resizes it, and uses the classify
function to predict the label and probability.
4
5
3.2 Using SqueezeNet:
Face recognition is a critical component of modern computer vision, enabling the
identification of individuals by analyzing unique facial features. SqueezeNet, a lightweight
convolutional neural network (CNN), is particularly suited for this task due to its compact
architecture and reduced computational requirements. By employing transfer learning,
SqueezeNet can be adapted for face recognition tasks, allowing the network to learn new
categories efficiently while leveraging pre-trained weights. This approach ensures high
accuracy and fast training, even on modest hardware.
Code Explanation:
Dataset Preparation:
● Load the image dataset using imageDatastore with labels derived from folder names.
● Split the data into training and validation sets with splitEachLabel.
Network Architecture Modification:
● Analyze the SqueezeNet architecture using analyzeNetwork.
● Replace the final convolutional and classification layers with task-specific layers
using replaceLayer.
Data Preprocessing:
● Resize the training and validation datasets to match the input layer size, ensuring
compatibility with the network.
● Convert grayscale images to RGB using augmentedImageDatastore.
Training the Network:
● Set training options, including learning rate, mini-batch size, and epochs, using
trainingOptions.
● Train the modified network using trainNetwork, monitor progress, and save the
trained model.
6
Testing the Network:
● Load the saved model, predict labels on the validation data, and calculate the
accuracy.
● Randomly select validation images and display them with predicted labels and
probabilities.
7
CONCLUSIONS
● This project demonstrates how MATLAB can be used for effective face detection in
images, videos, and real-time streams. The built-in `CascadeObjectDetector` provides a
reliable and efficient method for detecting faces in various contexts.
● The addition of tracking algorithms enhances the system's ability to follow detected faces
in videos and real-time streams, making it suitable for applications such as video
surveillance and human-computer interaction.
● The use of transfer learning expands the scope to face recognition, allowing the
pre-trained networks to be adapted to new datasets with minimal effort.
8
REFERENCES
[1] F Shaker, A Abdulelah 2020 Face Detection By some Methods based on MATLAB Journal
of Al- Qadisiyah for Computer Science and Mathematics 12–17,(2020).
[2] M Harahap, A Manurung, Priya,A Prakoso, M F Tambunan, Face tracking with camshaft
algorithm for detecting student movement in a class, IOP Conf. Series: Journal of Physics: Conf.
Series 1230, doi:10.1088/1742-6596/1230/1/012018, (2020).
[3] I. Fasel and J. R. Movellan. Comparison of neurally in-spired face detection algorithms. In
Proceedings of the international conference on artificial neural networks (ICANN2002). UAM,
(2021).
9
10