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

Nguyen Duy Khanh_Project_report_template

Uploaded by

Hien Ta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Nguyen Duy Khanh_Project_report_template

Uploaded by

Hien Ta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

International University

School of Electrical Engineering

Term Project Report


Topic: [FACE DETECED SYSTEM]

Submitted by

Students’ Name:Nguyễn Duy Khánh


ID: EEACIU22200
Contents
Experimental Procedure 3

Discussion of Results 7

Self-Evaluation 9

App packing 10

Code source 13

Outcome 13

References 15

International University 2
School of EE
Experimental Procedure
Objective
The purpose of this experiment is to create a face recognition system using
Python, which includes user authentication and admin management features.
The program integrates image processing (using OpenCV), GUI design
(Tkinter), and machine learning for face verification (DeepFace).
Setup
1. Hardware:
o A computer with Python installed.
o A camera (integrated or external) for capturing face images.
2. Software:
Python 3.x: Core programming language for the project.
o Python libraries:
▪ OpenCV: For real-time image and video processing.
▪ Tkinter: To create the graphical user interface.
▪ DeepFace: For deep learning-based face verification.
▪ NumPy: For numerical operations.
▪ PIL (Pillow): For image manipulation.
▪ The Haar Cascade XML file
(haarcascade_frontalface_default.xml) for detecting faces.
3. Data Collection:
o Images are captured in real time through the camera.
o Face images are saved in two folders:
▪ dataset: For user data.
▪ admin_faces: For admin authentication.

International University 3
School of EE
Procedure
1. User Interface:
o The GUI provides five main options:
▪ Add User
▪ Verify User
▪ Add Admin Face
▪ Admin
▪ Exit

2. Adding User:
o Users input their name and date of birth.
o The camera captures 10 face images, which are saved in the dataset
folder.
o Images are labeled with the user's name and a numerical index
(e.g., John_0.jpg).

International University 4
School of EE
3. Face Verification:
o The system captures a face image in real time.
o It compares the captured face with stored images using NumPy or
DeepFace.
o If a match is found, the user is identified.
4. Admin Features:

• Login Options:
Admins can log in using either a username/password or Face ID.

• Face ID Login:

• When Face ID is selected, DeepFace temporarily captures an image of the


admin through the camera.
• This temporary image is compared with the pre-stored images in the
admin_faces folder for authentication.
• If a match is found, the admin is granted access.

• Admin Privileges:

• Once logged in, admins can:


o Add their face to the admin_faces folder for future Face ID use.
o View user data stored in the dataset folder and double-click on
entries to see detailed information and images of users.

International University 5
School of EE
5. Error Handling:
o Logging is implemented to track errors during camera access, face
detection, or data saving.
o Proper error messages are displayed using Tkinter's messagebox.

International University 6
School of EE
Discussion of Results
Implementation Results
1. Face Detection:
o Effectiveness: The system utilizes Haar Cascade Classifier to
detect faces in real time. It works well in most scenarios,
especially under normal lighting conditions and frontal face
angles.
o Accuracy: Detected faces are cropped accurately and stored in the
designated folders (dataset for users and admin_faces for
admins) for further processing and comparison.
o Real-Time Processing: The frame-by-frame detection ensures
smooth performance without significant delays, enabling the
system to process live video streams effectively.
2. Face Verification:
o DeepFace Accuracy: The system uses DeepFace for face
verification, leveraging pre-trained deep learning models like
Facenet. This ensures high precision when comparing a captured
face with stored images.
o Fallback Method: When DeepFace is not available or feasible, the
system employs NumPy's distance metric to compare grayscale
images. Although less robust than DeepFace, it provides a reliable
alternative for basic matching needs.
3. Admin Authentication:
o Face ID Login:
▪ For Face ID login, the system temporarily captures a live
image of the admin and compares it with stored images in
the admin_faces folder using DeepFace.
▪ This approach ensures secure and seamless authentication
without requiring manual input.
o Username/Password Login:
▪ As a secondary option, admins can log in using a predefined
username and password combination (admin/admin123).
This ensures access even in cases where Face ID fails.
o Admin Privileges:
▪ After successful login, admins can manage face datasets,
view stored user data, and double-click on entries to see
detailed information, including the saved images.

International University 7
School of EE
Challenges
1. Lighting Conditions:
o Issue: Face detection accuracy decreases in low-light
environments or when faces are at extreme angles. This can lead
to missed detections or false negatives.
o Solution: In future iterations, integrating advanced detection
models like YOLO or RetinaFace can enhance performance
under challenging conditions.
2. Data Size:
o Issue: As the dataset grows, the verification process with
DeepFace slows down due to the increased number of
comparisons required.
o Solution: Optimization techniques, such as implementing an
indexing system or using database-driven storage, can reduce
search times and improve scalability.
3. Security:
o Issue: The current implementation stores face images without
encryption, making the system vulnerable to unauthorized access
or data theft.
o Solution: Introducing encryption for stored data and secure
database storage will significantly improve the system's security.

International University 8
School of EE
Self-Evaluation
Lessons Learned
• Teamwork:
o Collaboration in implementing different parts (GUI, detection, and
authentication) improved the overall system design.
• Technical Skills:
o Improved knowledge of Python libraries, especially OpenCV and
Tkinter.
o Gained experience in integrating machine learning models like
DeepFace into real-world applications.

International University 9
School of EE
App packing
1 Purpose of Packaging
Packaging ensures the application is portable and user-friendly, allowing it to
run on systems without requiring Python or external dependencies to be
installed. By creating a standalone executable, the program becomes easier to
distribute and use.
2 Tools Used for Packaging
• PyInstaller: A Python library that bundles the script and its dependencies
into an executable file.
• Additional Resources:
o background.jpg: An image resource for the GUI.
o background.ico: The icon used for the executable.
o haarcascade_frontalface_default.xml: Configuration file for face
detection.
3 Packaging Process
1. Prepare the Project:
o Ensure the project directory contains all required files:
▪ test2.py: The main script file.
▪ background.jpg: Background image for the GUI.
▪ background.ico: Icon for the executable.
▪ haarcascade_frontalface_default.xml: XML file for face
detection.
o Verify that all file paths in the script use relative references.
2. Install PyInstaller:
“pip install pyinstaller”

International University 10
School of EE
3. Execute the Packaging Command: Run the following command in the
terminal from the project directory:
“pyinstaller --onefile --noconsole --name "Face Recognition" --
icon=background.ico --add-data "background.jpg;." test2.py”
o --onefile: Combines all files into a single executable.
o --noconsole: Removes the console window for a cleaner GUI
experience.
o --name "Face Recognition": Names the executable file as "Face
Recognition".
o --icon=background.ico: Sets the application's icon to
background.ico.
o --add-data "background.jpg;.": Includes background.jpg in the
package and places it in the same directory as the executable.
4.Output:
o The final executable (Face Recognition.exe) will be located in the
dist folder generated by PyInstaller.

International University 11
School of EE
5.Test the Executable:
Run the generated .exe file on multiple systems to ensure:
The GUI loads correctly.
The camera works as expected.
All resources (e.g., background image and face detection configuration) are
accessible.
6. Key Considerations
• Icon Design:
o Use an .ico file that is visually appealing and relevant to the
application.
• Resource Paths:
o Ensure all resources are included in the build using --add-data.
• Performance:
o Large dependencies or datasets may increase the size of the final
executable.
o Use optimization techniques to minimize the size and improve
performance.

International University 12
School of EE
Code source
The source code and file will be attached to the report.
Outcome
The final application performs as intended, achieving accurate face recognition
alongside a user-friendly and responsive graphical user interface (GUI). Below
is a breakdown of its key achievements:
1. Face Recognition Accuracy:
o The system utilizes a combination of Haar Cascade for face
detection and DeepFace for verification, ensuring precise and
reliable recognition in real-time scenarios.
o The fallback to NumPy’s distance-based method ensures
functionality even without access to advanced deep learning
models.
2. User-Friendly GUI:
o The Tkinter-based GUI offers an intuitive design, allowing users to
interact with the system effortlessly. Key features include:
▪ Clear buttons for each primary functionality: adding users,
verifying users, admin login, and exiting the application.
▪ Popup dialogs guide users through steps like entering their
name, logging in, or managing datasets.
o Admin-specific features, such as Face ID login and dataset
management, enhance the overall utility of the system.
3. Performance and Responsiveness:
o The multi-threaded implementation ensures smooth operation,
preventing the interface from freezing during real-time face
detection and verification.
o The system captures and processes live images without noticeable
lag, making it suitable for practical use cases.

International University 13
School of EE
4. App Packaging and Portability:
o Packaging the application into a standalone executable using
PyInstaller has significantly enhanced its usability and portability.
Users can run the application on any compatible system without
needing to install Python or additional libraries.
o The inclusion of all necessary resources (e.g., Haar Cascade XML
file, GUI assets) within the executable ensures seamless operation
across different environments.
5. Practical Applications:
o The system can be employed in various scenarios, such as user
authentication, attendance systems, and secure admin
management.
o The admin features, including Face ID login and dataset
visualization, make it adaptable for real-world deployments.
6. Room for Improvement:
o While the application meets its primary objectives, there are areas
for enhancement, including:
▪ Optimizing the verification process for large datasets.
▪ Enhancing security by encrypting stored face images.
▪ Improving detection accuracy under challenging conditions
such as poor lighting or extreme face angles.
In summary, the system demonstrates robust functionality, achieving its
objectives while providing a strong foundation for future improvements.
Packaging the application into a standalone executable further expands its
reach, making it accessible and easy to use for a broader audience.

International University 14
School of EE
References

1. OpenCV Documentation: https://docs.opencv.org


2. DeepFace GitHub: https://github.com/serengil/deepface
3. PyInstaller Documentation: https://pyinstaller.org
4. Haar Cascade Classifiers:
https://github.com/opencv/opencv/tree/master/data/haarcascad
es

International University 15
School of EE

You might also like