0% found this document useful (0 votes)
29 views

Face Detection (Python)

This document is a project report on face recognition using Python programming. It includes an introduction to face recognition and detection, a literature review on relevant books and approaches, and an explanation of digital image processing techniques for face detection and recognition. The project implements these techniques in Python and analyzes the output to recognize faces. It aims to identify faces as known or unknown individuals using a database and concludes the technology has applications in security, biometrics, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Face Detection (Python)

This document is a project report on face recognition using Python programming. It includes an introduction to face recognition and detection, a literature review on relevant books and approaches, and an explanation of digital image processing techniques for face detection and recognition. The project implements these techniques in Python and analyzes the output to recognize faces. It aims to identify faces as known or unknown individuals using a database and concludes the technology has applications in security, biometrics, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Project Name : Face Recognition Academic Year : 2019-2020

Subject Name: Python Programming Semester : Sixth

[ college logo ]

A STYDY ON

Face Recognition

MICRO PROJECT REPORT


Submitted in Nov 2018 by the group of……3….students

Sr. Roll No Enrollment Seat No


Full name of Student
No (Sem- No (Sem-
iv) iv)
1
2
3

Under the Guidance of


[ your guide name ]
in
Three Years Diploma Program in Engineering & Technology of Maharashtra
State Board of Technical Education, Mumbai (Autonomous)
ISO 9001:2008 (ISO/IEC-27001:2013)
at

[ your college name ]

1
MAHARASHTRA STATE BOARD OF TECHNICAL
EDUCATION, MUMBAI

Certificate
This is to certify that Mr. /Mrs.

Roll No: of Sixth Semester of Diploma

in Engineering & Technology at [ your college name ] , has completed the Micro

Project satisfactorily in Subject Python in the academic year2019-2020 as per the

MSBTE prescribed curriculum of I Scheme.

Place: Pune Enrollment No:

Date: / /2020 Exam Seat No:

Project Guide Head of the Department Principal

Head of
Institute
2
INDEX

Sr. Title Page No .


Abstract
1. Introduction
2. Literature Survey
3. Digital Image Processing
a) Face Detection
b) Face Recognition
5. Implementation In Python
6. Output
7. Conclusions
8. References

Abstract
3
The face is one of the easiest ways to distinguish the individual identity of each other. Face
recognition is a personal identification system that uses personal characteristics of a person to
identify the person's identity. Human face recognition procedure basically consists of two phases,
namely face detection, where this process takes place very rapidly in humans, except under
conditions where the object is located at a short distance away, the next is the introduction,
which recognize a face as individuals. Stage is then replicated and developed as a model for
facial image recognition (face recognition) is one of the much-studied biometrics technology and
developed by experts.
There are two kinds of methods that are currently popular in developed face recognition pattern
namely, Eigenface method and Fisherface method. Facial image recognition Eigenface method is
based on the reduction of facedimensional space using Principal Component Analysis (PCA) for
facial features.
The main purpose of the use of PCA on face recognition using Eigen faces was formed (face
space) by finding the eigenvector corresponding to the largest eigenvalue of the face image. The
area of this project face detection system with face recognition is Image processing.
The software requirements for this project is matlab software. Keywords: face detection, Eigen
face, PCA, matlab Extension: There are vast number of applications from this face detection
project, this project can be extended that the various parts in the face can be detect which are in
various directions and shapes.

4
Introduction

Face recognition is the task of identifying an already detected object as a known or unknown
face.Often the problem of face recognition is confused with the problem of face detectionFace
Recognition on the other hand is to decide if the "face" is someone known, or unknown, using
for this purpose a database of faces in order to validate this input face.

1.1 FACE RECOGNIZATION: DIFFERENT APPROACHES OF FACE RECOGNITION:


There are two predominant approaches to the face recognition problem: Geometric (feature
based) and photometric (view based). As researcher interest in face recognition continued,
many different algorithms were developed, three of which have been well studied in face
recognition literature. Recognition algorithms can be divided into two main approaches: 1.
Geometric: Is based on geometrical relationship between facial landmarks, or in other words
the spatial configuration of facial features. That means that the main geometrical features of
the face such as the eyes, nose and mouth are first located and then faces are classified on
the basis of various geometrical distances and angles between features. (Figure 3) 2.
Photometric stereo: Used to recover the shape of an object from a number of images taken
under different lighting conditions. The shape of the recovered object is defined by a
gradient map, which is made up of an array of surface normals (Zhao and Chellappa, 2006)
(Figure 2) Popular recognition algorithms include: 1. Principal Component Analysis using
Eigenfaces, (PCA) 2. Linear Discriminate Analysis, 3. Elastic Bunch Graph Matching using
the Fisherface algorithm.

1.2 FACE DETECTION: Face detection involves separating image windows into two classes;
one containing faces (tarning the background (clutter). It is difficult because although

5
commonalities exist between faces, they can vary considerably in terms of age, skin colour and
facial expression. The problem is further complicated by differing lighting conditions, image
qualities and geometries, as well as the possibility of partial occlusion and disguise. An ideal
face detector would therefore be able to detect the presence of any face under any set of lighting
conditions, upon any background. The face detection task can be broken down into two steps.
The first step is a classification task that takes some arbitrary image as input and outputs a
binary value of yes or no, indicating whether there are any faces present in the image. The
second step is the face localization task that aims to take an image as input and output the
location of any face or faces within that image as some bounding box with (x, y, width, height).
The face detection system can be divided into the following steps:-

1. Pre-Processing: To reduce the variability in the faces, the images are processed before they
are fed into the network. All positive examples that is the face images are obtained by cropping
images with frontal faces to include only the front view. All the cropped images are then
corrected for lighting through standard algorithms.

2. Classification: Neural networks are implemented to classify the images as faces or nonfaces
by training on these examples. We use both our implementation of the neural network and the
Matlab neural network toolbox for this task. Different network configurations are experimented
with to optimize the results. 3. Localization: The trained neural network is then used to search
for faces in an image and if present localize them in a bounding box. Various Feature of Face on
which the work has done on:- Position Scale Orientation Illumination.

Literature Survey

6
Title of the book Author Publication

PHP Objects, Patterns, and Matt Zandstra Paperback


Practice

PHP and MySQL Web Luke Welling Developer's Library


Development

PHP Cookbook David Sklar Paperback

William Sanders
Learning PHP Design Paperback
Patterns

DIGITAL IMAGE PROCESSING

7
Interest in digital image processing methods stems from two principal application areas:

1. Improvement of pictorial information for human interpretation

2. Processing of scene data for autonomous machine perception

In this second application area, interest focuses on procedures for extracting image information
in a form suitable for computer processing.

Examples includes automatic character recognition, industrial machine vision for product
assembly and inspection, military recognizance, automatic processing of fingerprints etc.

Image:

Am image refers a 2D light intensity function f(x, y), where(x, y) denotes spatial coordinates and
the value of f at any point (x, y) is proportional to the brightness or gray levels of the image at
that point. A digital image is an image f(x, y) that has been discretized both in spatial coordinates
and brightness. The elements of such a digital array are called image elements or pixels.

A simple image model:

To be suitable for computer processing, an image f(x, y) must be digitalized both spatially and in
amplitude. Digitization of the spatial coordinates (x, y) is called image sampling. Amplitude
digitization is called gray-level quantization.

The storage and processing requirements increase rapidly with the spatial resolution and the
number of gray levels.

Example: A 256 gray-level image of size 256x256 occupies 64k bytes of memory.

FACE DETECTION

The problem of face recognition is all about face detection. This is a fact that seems quite bizarre

8
to new researchers in this area. However, before face recognition is possible, one must be able to
reliably find a face and its landmarks. This is essentially a segmentation problem and in practical
systems, most of the effort goes into solving this task. In fact the actual recognition based on
features extracted from these facial landmarks is only a minor last step.
There are two types of face detection problems:
1) Face detection in images and 2) Real-time face detection

FACE DETECTION IN IMAGES:

Most face detection systems attempt to extract a fraction of the whole face, thereby eliminating
most of the background and other areas of an individual's head such as hair that are not necessary
for the face recognition task. With static images, this is often done by running a across the
image. The face detection system then judges if a face is present inside the window (Brunelli and
Poggio, 1993). Unfortunately, with static images there is a very large search space of possible
locations of a face in an image

REAL-TIME FACE DETECTION:

Real-time face detection involves detection of a face from a series of frames from a video
capturing device. While the hardware requirements for such a system are far more stringent,
from a computer vision stand point, real-time face detection is actually a far simpler process than
detecting a face in a static image. This is because unlike most of our surrounding
Department of ECE Page 28 environment, people are continually moving. We walk around,
blink, fidget, wave our hands about, etc.

FACE DETECTION PROCESS:

It is process of identifying different parts of human faces like eyes, nose, mouth, etc… this

9
process can be achieved by using MATLAB code In this project the author will attempt to detect
faces in still images by using image invariants. To do this it would be useful to study the grey
scale intensity distribution of an average human face. The following 'average human face' was
constructed from a sample of 30 frontal view human faces, of which 12 were from females and
18 from males. A suitably scaled color map has been used to highlight grey-scale intensity
differences.

FACE RECOGNITION

Over the last few decades many techniques have been proposed for face recognition. Many of the
techniques proposed during the early stages of computer vision cannot be considered successful,
but almost all of the recent approaches to the face recognition problem have been creditable.
According to the research by Brunelli and Poggio (1993) all approaches to human face
recognition can be divided into two strategies:
(1) Geometrical features and
(2) Template matching.

FACE RECOGNITION USING GEOMETRICAL FEATURES:

This technique involves computation of a set of geometrical features such as nose width and
length, mouth position and chin shape, etc. from the picture of the face we want to recognize.
This set of features is then matched with the features of known individuals. A suitable metric
such as Euclidean distance (finding the closest vector) can be used to find the closest match.
Most pioneering work in face recognition was done using geometric features (Kanade, 1973),
although Craw et al. (1987) did relatively recent work in this area.
The advantage of using geometrical features as a basis for face recognition is that recognition is
possible even at very low resolutions and with noisy images (images with many disorderly pixel
intensities). Although the face cannot be viewed in detail its overall geometrical configuration
can be extracted for face recognition. The technique's main disadvantage is that automated
extraction of the facial geometrical features is very hard. Automated geometrical Department of

10
ECE Page 35 feature extraction based recognition is also very sensitive to the scaling and
rotation of a face in the image plane (Brunelli and Poggio, 1993). This is apparent when we
examine Kanade's(1973) results where he reported a recognition rate of between 45-75 % with a
database of only 20 people. However if these features are extracted manually as in Goldstein et
al. (1971), and Kaya and Kobayashi (1972) satisfactory results may be obtained.

Face recognition using template matching:

This is similar the template matching technique used in face detection, except here we are not
trying to classify an image as a 'face' or 'non-face' but are trying to recognize a face.
Whole face, eyes, nose and mouth regions which could be used in a template matching strategy.
The basis of the template matching strategy is to extract whole facial regions (matrix of pixels)
and compare these with the stored images of known individuals. Once again Euclidean distance
can be used to find the closest match. The simple technique of comparing grey-scale intensity
values for face recognition was used by Baron (1981). However there are far more sophisticated
methods of template matching for face recognition. These involve extensive preprocessing and
transformation of the extracted grey-level intensity values.

Implementation in Python:
Now, let us go through the code to understand how it works:

# import the libraries

import os

import face_recognition

These are simply the imports. We will be using the built-in os library to read all the images in
our corpus and we will use face_recognition for the purpose of writing the algorithm.

11
# make a list of all the available images

images = os.listdir('images')

This simple code helps us identify the path of all of the images in the corpus. Once this line is
executed, we will have:

images = ['shah_rukh_khan.jpg', 'warren_buffett.jpg', 'barack_obama.jpg',

'ray_dalio.jpg', 'bill_gates.jpg', 'jeff_bezos.jpg', 'mark_zuckerberg.jpg']

Now, the code below loads the new celebrity’s image:

# load your image

image_to_be_matched = face_recognition.load_image_file('my_image.jpg')

To make sure that the algorithms are able to interpret the image, we convert the image to a
feature vector:

# encoded the loaded image into a feature vector

image_to_be_matched_encoded = face_recognition.face_encodings(

image_to_be_matched)[0]

The rest of the code now is fairly easy:

12
# iterate over each image

for image in images:

# load the image

current_image = face_recognition.load_image_file("images/" + image)

# encode the loaded image into a feature vector

current_image_encoded = face_recognition.face_encodings(current_image)[0]

# match your image with the image and check if it matches

result = face_recognition.compare_faces(

[image_to_be_matched_encoded], current_image_encoded)

# check if it was a match

if result[0] == True:

print "Matched: " + image

13
else:

print "Not matched: " + image

OUTPUT:

Matched: shah_rukh_khan.jpg

Not matched: warren_buffett.jpg

Not matched: barack_obama.jpg

Not matched: ray_dalio.jpg

Not matched: bill_gates.jpg

14
Not matched: jeff_bezos.jpg

Not matched: mark_zuckerberg.jpg

Conclusion

We have concluded that we have successfully developed a PHP based web application for
creating the assignment for students in the easiest way. We have implemented FPDF library and
do a lot of customization so that teachers don’t need to change anything. We have applied a lot
of fonts to this pdf creation. In this project development we have also developed a question bank

15
section through which teachers can get their question from respective department.

References

Books:

16
 The Joy of PHP Programming: A Beginner’s Guide – by Alan Forbes

 PHP & MySQL Novice to Ninja – by Kevin Yank

 Head First PHP & MySQL – by Lynn Beighley & Michael Morrison

Websites:

 https://www.w3schools.com/php/

 https://www.tutorialspoint.com/php/index.htm

17

You might also like