Report
Report
A PROJECT REPORT
Submitted By
          DEEPAKVIGNESH S               (720821106007)
          MATHANRAJ M                   (720821106031)
          SANTHEESH S.K                 (720821106045)
          VIGNESHWARAN S                (720821106062)
degree of
BACHELOR OF TECHNOLOGY
In
INFORMATION TECHNOLOGY
                       APRIL 2025
                         BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
on …………………
       We express our sincere thanks to Hindusthan Educational and Charitable Trust for
providing us the necessary facilities to bring out the project successfully. We   felt gratefulness
to record our thanks to the Managing Trustee Tmt.Saraswathi Khannaiyann for all the
support and the ray of strengthening hope extended to our project. It is a moment of immense
pride for us to reveal profound thanks to our respected Principal, Dr.C.Natarajan, M.E.,Ph.D.,
who happens to be the striving force in all our endeavours.
       A word of thanks would not be sufficient for the work of our project guide
Mrs.K.Suganya,M.E,(Ph.D) Assistant Professor, Department of Information Technology
whose leads us through every trying circumstance . We deeply express our gratitude to all the
Faculty Members and Support staff of the Department of Information Technology, for their
encouragement, which we have received throughout our project.
                                                                            DEEPAKVIGNESH S
                                                                            MATHANRAJ.M
                                                                            SANTHEESH S.K
                                                                            VIGNESHWARAN.S
                                  ABSTRACT
individuals such as suspects or thieves. Developed using Python and the Flask
including Haar Cascade classifiers and YOLO for effective face detection, and
image, personal details, camera ID, location, and timestamp—is securely stored
for further analysis. Once a match is detected, the system sends real-time email
                                     iv
                  TABLE OF CONTENTS
          ABSTRACT                                     iv
          LIST OF FIGURES                              vii
          LIST OF ABBREVIATIONS                        viii
1         INTRODUCTION
    1.1   Overview of the Problem                      1
    1.2   Problem Statement                            2
    1.3   Objectives                                   3
    1.4   Scope                                        4
2         LITERATURE SURVEY                            5
3         SYSTEM DESIGN
    3.1   Existing Surveillance System                 10
    3.2   Proposed Surveillance System                 11
    3.3   Technologies in Facial Recognition           12
4         SYSTEM REQUIREMENTS
    4.1   Hardware Requirements                        13
    4.2   Software Requirements                        13
5         SYSTEM ARCHITECTURE
    5.1   Architecture Diagram                         14
    5.2   Module-wise Description                      16
    5.3   Workflow of the System                       17
6         TECHNOLOGIES USED
    6.1   Programming Languages and Frameworks         18
    6.2   Face Detection and Recognition Algorithms    18
    6.3   Database and Storage                         18
    6.4   Web Technologies                             18
7         IMPLEMENTATION
    7.1   Surveillance Camera Integration              19
    7.2   Real-Time Face Detection and Recognition     20
    7.3   Database Connectivity                        21
    7.4   Alert System via Mail                        22
     7.5    Web Interface for Admin Monitoring       23
8           MODULES
     8.1    Face Detection Module                    25
     8.2    Face Recognition Module                  26
     8.3    Real-Time Video Processing               27
     8.4    Alert and Notification Module            28
     8.5    Web Interface Module                     29
9           TESTING
     9.1    Testing Methodology                      30
     9.2    Test Cases                               31
     9.3    Limitations and Improvements             32
10          RESULTS AND OUTPUTS
     10.1   Sample Screenshots                       34
     10.2   Email Alerts and Notifications           35
11          CONCLUSION
     11.1   Summary of the Project                   36
     11.2   Future Enhancement                       36
12          APPENDIX
     12.1   Code Snippets                            37
     12.2   Database Collection and Sample Entries   41
13          REFERENCES                               42
               LIST OF FIGURES
                        vii
         LIST OF ABBREVIATIONS
                  viii
                                     CHAPTER 1
                                 1.INTRODUCTION
1.1 OVERVIEW OF THE PROBLEM
       The increasing rate of thefts and unauthorized intrusions in both public and private
   spaces has highlighted the inefficiency of traditional surveillance systems, which primarily
   rely on manual monitoring and basic motion detection. These systems often fail to provide
   real-time alerts or identify individuals accurately, especially in complex or crowded
   environments. There is a growing need for intelligent surveillance solutions that can
   automatically detect, recognize, and alert authorities about suspicious activities or known
   criminals.
       The absence of integrated face recognition and alert mechanisms in conventional CCTV
   setups makes it challenging to respond promptly to security threats. This project aims to
   address these limitations by developing an advanced surveillance system that uses facial
   recognition technology to automatically identify individuals from a pre-existing database
   and generate instant alerts, ensuring quicker response times and enhanced safety.
       This project aims to build a smart, face recognition-based surveillance system capable
   of identifying potential threats in real-time and notifying security personnel through
   automated alerts. The goal is to enhance overall safety, improve incident response, and set
   a new standard for modern security systems.
       In today’s world, surveillance is crucial to ensuring public safety and deterring criminal
   activities. Traditional CCTV systems lack intelligent recognition features, making manual
   monitoring ineffective and time-consuming. There's a growing need for smart surveillance
   that can automatically identify individuals of interest, especially repeat offenders or known
   thieves. With the rise of urban crime, instant detection and alert systems have become
                                               1
   essential. This project aims to solve these challenges using face recognition and real-time
   alert mechanisms.
       Moreover, manual monitoring of camera feeds is not only time-consuming but also
   prone to human error. Therefore, there is a pressing need for an automated surveillance
   system that leverages facial recognition technology to detect and identify individuals in real-
   time, integrate with a database for verification, and promptly alert authorities through a
   reliable communication channel, such as email notifications, to enhance the overall security
   infrastructure.
                                                2
    project aims to build such an intelligent surveillance system using facial recognition and
    location-based alerts.
1.3 OBJECTIVES
        Beyond real-time detection and alert generation, the system also aims to promote
    scalability, accuracy, and ease of use. By utilizing advanced facial recognition algorithms
    like Facenet, the system ensures high precision in identifying individuals, even in
    challenging conditions such as low light, different angles, or crowded environments. The
    integration of multiple camera inputs and centralized data storage further strengthens the
    system's ability to monitor large or multi-location premises effectively. Moreover, emphasis
    is placed on maintaining user privacy and data security, ensuring that the captured data is
    encrypted and accessible only to authorized personnel. Together, these objectives position
    the Facenet Surveillance System as a robust, future-ready solution for modern surveillance
    challenges.
                                               3
1.4 SCOPE
        The scope of this project includes the development of a real-time surveillance system
    integrated with face detection and recognition modules, video processing through
    surveillance cameras, and a notification system for alerting authorities. It involves using
    advanced algorithms like Haar Cascade or YOLO for face detection and Facenet for
    recognition, with MongoDB as the backend for storing face data and associated details. The
    system also includes a web-based interface for displaying detection results, alert history, and
    basic data analytics. Designed to be scalable and flexible, this system can be implemented
    across various sectors such as educational institutions, corporate offices, residential areas,
    and public spaces where continuous surveillance and rapid threat detection in public areas,
    rural areas and private malls and stores.
        Furthermore, the project scope extends to include a user-friendly admin interface that
    offers functionalities such as image uploads, database management, and live video feed
    access. The system will also maintain a history log of alerts and detections, offering basic
    analytical insights such as frequency of incidents and hotspot zones. These features aim to
    improve decision-making and enhance situational awareness. The scalable architecture
    ensures that new modules like mobile alerts, access control systems, or cloud integration
    can be added in future phases without disrupting core functionality.
        This project focuses on building a smart surveillance solution for limited environments
    such as homes, colleges, or small offices. It uses Python, Flask, and OpenCV to process
    real-time webcam or mobile footage for facial detection. The scope includes storing thief
    data, sending email alerts, and displaying results on a local web interface. It does not cover
    cloud deployment or large-scale public surveillance yet. Future enhancements may include
    multi-camera integration, advanced AI models, and wider area coverage.
                                                  4
                                       CHAPTER 2
                                2.LITERATURE SURVEY
2.1 Surveillance Systems Using Deep Learning-Based Face Recognition for Enhanced
Security
Methodology
            The authors proposed a CNN-based deep learning framework for facial recognition.The
     system processes live surveillance feeds for real-time detection.They integrated face
     encoding with database matching to improve reliability.Transfer learning was utilized to
     speed up model training and adaptation.
Findings
            The model showed a high recognition rate in different lighting conditions. Real-time
     processing speed met surveillance requirements. Performance surpassed traditional machine
     learning approaches. It demonstrated effective operation in both indoor and outdoor
     scenarios.
2.2 Enhancing Face Recognition with Deep Learning Models for Real-Time Surveillance
     Year: 2023
Objective
     To build a real-time facial recognition system with optimized deep learning models.
Methodology
            A combination of YOLO for detection and FaceNet for recognition was used. Data
     augmentation was applied to improve robustness .Model was trained on custom surveillance
     datasets.Edge computing techniques were integrated to minimize latency.
                                                 5
Findings
            High precision and recall were recorded in real-world environments. System
     maintained real-time performance even with limited hardware. FaceNet produced consistent
     embeddings under varied poses.YOLO handled fast-moving faces effectively.
2.3 Surveillance System Using FaceNet and YOLO for Real-Time Detection and Recognition
Methodology
            YOLO detects faces from video streams, and FaceNet performs recognition. MongoDB
     stores user data and facial encodings. Real-time stream handling was implemented using
     OpenCV. Python and Flask were used for backend integration.
Findings
            System showed high speed and accuracy in face recognition. Multiple faces could be
     tracked and identified simultaneously. It reduced false positives in complex backgrounds.
     The integration was scalable for multi-camera environments.
2.4 Real-Time Face Recognition Using Deep Learning for Surveillance Systems
Year: 2021
Objective
To create an accurate and responsive deep learning face recognition system for surveillance.
Methodology
            Used a custom CNN architecture tailored for low-resolution face inputs. Introduced
     spatial-temporal filtering to improve detection. Optimized the model using batch
     normalization. Tested on CCTV datasets for real-world performance.
                                                6
Findings
           Accuracy improved significantly over baseline CNNs. System adapted well to real-time
     constraints. Low-light detection was enhanced through preprocessing. Deployment on edge
     devices was successful.
Year: 2021
Objective
Methodology
Findings
           CNN-based models dominate current research for accuracy and speed. Real-time
     deployment remains a challenge for large-scale systems. Training data quality heavily
     impacts model performance. The paper highlights gaps in privacy and ethical concerns.
Year: 2021
Objective
Methodology
           Developed a lightweight CNN for fast facial recognition on campus. Used RFID
     integration for identity verification. Implemented the system with student image databases.
                                                 7
Findings
Year: 2021
Objective
Methodology
      The paper reviews leading models such as DeepFace, FaceNet, and ArcFace. Discussed
  the importance of embedding learning and margin losses. Evaluated model robustness to
  occlusion and pose changes. Outlined open challenges in large-scale deployment.
Findings
      ArcFace and FaceNet were most accurate among benchmarked models. Face alignment
  significantly improves detection quality. Ethical and bias concerns were prominent in
  datasets. Suggested improvements for real-time systems using hybrid models.
2.8 Hyperface: A Deep Learning Approach for Face Detection in Surveillance Systems
Year: 2021
Objective
Methodology
      Hyperface performs face detection, landmark localization, pose estimation, and gender
  recognition. The model shares features across tasks using a multi-task CNN. Implemented
  using Caffe framework and trained on AFLW dataset. Combined spatial features for
  improved detection precision.
                                              8
Findings
2.9 Face Detection, Pose Estimation, and Landmark Localization in the Wild
Year: 2020
Objective
Methodology
     Introduced a deformable part model (DPM) for face analysis. Used annotated facial
 parts for training on wild datasets. Handled extreme head poses and occluded
 features.Incorporated tree-structured models for landmark detection.
Findings
Year: 2020
Objective
Methodology
     Used transfer learning with pretrained CNNs for feature extraction. Implemented real-
 time face tracking with dlib and OpenCV. Built a custom dataset for system training.
                                            9
                                       CHAPTER 3
                                  3. SYSTEM DESIGN
3.1 EXISTING SURVEILLANCE SYSTEM
       The existing surveillance systems primarily rely on Closed-Circuit Television (CCTV)
   cameras that continuously record video footage, which can be monitored live or reviewed
   later for investigation purposes. These systems are widely used in public and private spaces
   for security monitoring and crime prevention. However, most of these systems operate
   passively, meaning they do not possess the intelligence to detect or respond to suspicious
   activities automatically. They depend heavily on manual monitoring by security personnel,
   which is both time-consuming and prone to human error. In crowded or high-traffic areas,
   it becomes extremely difficult to track specific individuals or incidents without hours of
   video review. Moreover, traditional systems lack the ability to identify known criminals or
   intruders in real-time, offering no immediate alerts or warnings to the authorities. As a result,
   the existing setups often fail to prevent crimes or take timely action. The absence of
   integration with technologies like facial recognition, automated alerts, and real-time data
   analysis limits the efficiency and responsiveness of current surveillance infrastructure,
   highlighting the need for smarter, AI-driven solutions.
       Additionally, these traditional systems often lack centralized data management, making
   it difficult to share information across locations or collaborate with law enforcement
   agencies in real-time. The absence of automation also increases operational costs, as more
   manpower is required to monitor numerous camera feeds continuously. In rapidly evolving
   threat scenarios, such as theft, intrusion, or vandalism, delayed detection can lead to
   significant damage or loss. The lack of smart search features further hampers the
   investigation process, as security teams must sift through vast amounts of footage manually.
   Moreover, without analytics or pattern recognition capabilities, these systems cannot
   identify recurring incidents or potential hotspots for criminal activity. In essence, while
   conventional CCTV systems provide visual evidence, they fall short in delivering proactive
   and intelligent security. This highlights the urgent demand for integrating AI technologies
   to transform passive monitoring into active threat detection and prevention. These Existing
   System Will reduces accuracy in terms of recognition and Detection in Systems using the
   Smart Thief Alert System which triggers alerts mail through an email using the simple
   transfer protocol.
                                                10
3.2 PROPOSED SURVEILLANCE SYSTEM
       The proposed surveillance system is an intelligent, real-time solution that integrates
   advanced face detection and recognition technologies with surveillance cameras to enhance
   security and monitoring capabilities. Unlike traditional CCTV systems, this system can
   automatically detect faces from live video feeds, compare them against a pre-stored database
   using facial recognition algorithms, and instantly identify known suspects or unauthorized
   individuals. Upon recognition, it sends automated email alerts to concerned authorities with
   details such as the captured face image, time of detection, and location, enabling quicker
   responses and preventive action. The system also features a web-based interface for the
   administrator to monitor alerts, view recognized faces, and manage stored data efficiently.
   Built with technologies like OpenCV, Facenet, MongoDB, and Flask, the system ensures
   high accuracy, real-time processing, and seamless database connectivity. This proactive
   approach significantly reduces the dependency on manual monitoring and enhances the
   effectiveness of surveillance, making it suitable for deployment in schools, offices,
   residential complexes, and public areas where security is a top priority.
                                                11
3.3 TECHNOLOGIES IN FACIAL RECOGNITION
       Facial recognition technology utilizes advanced computer vision and deep learning
   methods to identify or verify individuals based on facial features. Early techniques like
   Eigenfaces and Fisherfaces used linear projections to analyze and compare face patterns.
   With the rise of deep learning, Convolutional Neural Networks (CNNs) became the
   foundation for extracting high-level facial features. Libraries like OpenCV offer robust face
   detection tools using Haar Cascades and DNN models. Facenet, a widely used model,
   converts facial images into numerical embeddings for accurate recognition. Dlib and
   DeepFace are other popular frameworks offering pre-trained models for face detection and
   alignment. YOLO (You Only Look Once) is often used for real-time face detection due to
   its speed and precision. These technologies are trained on large datasets like LFW and
   VGGFace2 to improve recognition accuracy. Face alignment and landmark detection help
   in standardizing facial orientation before matching. Real-time processing using these
   models enables surveillance systems to respond quickly to detected threats. Integration with
   databases and alert systems makes facial recognition a powerful tool for intelligent security
   monitoring. These Technologies Requires high Level System Components and Cameras for
   Surveillance System to Detect images by using an High Quality Cameras. These System
   Enhances the Quality for Surveillance and Monitoring Controls through the Systems which
   is Installed in an Public and Rural Areas.
                                                12
                             CHAPTER 4
4.SYSTEM REQUIREMENTS
DATABASE :Mongodb
                                13
                           CHAPTER 5
5. SYSTEM ARCHITECTURE
                               14
    The architecture of the Facenet Surveillance System is designed to ensure real-time face
detection, recognition, alert generation, and monitoring via a web interface. The system
begins with input from surveillance cameras installed at strategic locations. These cameras
continuously capture video streams which serve as the primary input source for the system.
The captured frames are passed into the Face Detection Module, which uses Haar Cascades
and YOLO (You Only Look Once) object detection algorithms to identify human faces
within the video feed. Once a face is detected, the image is forwarded to the Face
Recognition Module, where the Facenet model is used to extract facial features and compare
them with the stored database of known criminals or suspects. If a match is found, the system
proceeds to the Alert Generation Module. This module triggers an automated alert via SMTP
(Simple Mail Transfer Protocol) to predefined email addresses. The alert includes the
suspect’s details, the captured face, and the location information. Simultaneously, all
detection data, including timestamps, location, camera ID, and face image path, are stored
in a MongoDB database for record-keeping and future reference. The Web Interface
Module, built using Flask along with HTML, CSS, and JavaScript, allows the admin to log
in and view real-time notifications, past detections, and detailed logs through an interactive
dashboard. The modular flow ensures a seamless integration between hardware (cameras),
software (detection and recognition), storage (MongoDB), and communication (email
alerts), forming a robust surveillance solution. This architecture not only ensures real-time
monitoring and rapid alerts but also maintains data privacy and supports future scalability,
such as adding more cameras or integrating location-based tracking. Additionally, the
architecture supports multi-threaded processing to handle real-time video feeds efficiently
without lag. The modular nature of each component allows for easy debugging,
maintenance, and upgrades.
    The architecture diagram of the Facenet Surveillance System illustrates the flow of data
and interaction between various modules of the system. It begins with real-time video input
from a webcam or mobile camera, which is processed using OpenCV for face detection. The
detected face is then compared with stored images in the MongoDB database to identify any
match. If a match is found, the system retrieves the suspect’s details and location, and
immediately sends an alert email to the admin. Simultaneously, the web interface is updated
with the image, name, and location of the identified person. This layered architecture
ensures efficient communication between the video input, face recognition engine, database,
alert system, and user interface.
                                            15
5.2 MODULE – WISE DESCRIPTION
         The Module-wise Description diagram illustrates the complete workflow of the Facenet
   Surveillance System. It begins with surveillance cameras capturing live video feeds, which
   are then sent to the real-time video processing unit. This unit handles live footage and
   forwards it to the face detection module, where Haar Cascades or YOLO algorithms identify
   human faces. Detected faces are passed to the face recognition module, which utilizes the
   Facenet algorithm to match them against a pre-stored dataset. Once a match is found, the
   details are fetched from the connected database. Finally, if the face matches with an entry
   flagged as a suspect or thief, an alert system is triggered, notifying the admin via email. This
   structured flow ensures a reliable, automated surveillance mechanism. The module diagram
   represents the core components of the Facenet Surveillance System and their interactions. It
   includes modules such as Face Detection, Face Recognition, Database Integration, Real-Time
   Alert System, and Web Interface. Each module performs a specific task and works together
   to enable accurate, real-time surveillance and alerting.
                                                 16
5.3 WORKFLOW OF THE SYSTEM
      The workflow begins with the surveillance camera capturing real-time video footage.
  This feed is processed by the face detection module using Haar Cascade or YOLO algorithms
  to identify faces in each frame. Detected faces are then passed to the face recognition module,
  which uses the Facenet algorithm to match them against a database of known individuals,
  particularly thief profiles. If a match is found, the system logs the recognized face along with
  a timestamp and camera ID in the database. The database stores all detection records,
  including images and related details. The web interface fetches data from the database and
  displays it in an organized manner for easy monitoring. Admins can view both live and
  historical detections through this interface. This end-to-end workflow ensures efficient
  detection, alerting, and surveillance. Each and Every Modules has Different modular and
  building approach to create the entries in database for Fetching.
                                                17
                                       CHAPTER 6
6. TECHNOLOGIES USED
  Python: Used for backend development, handling face detection, recognition algorithms, and
  database integration.
  HTML, CSS, JavaScript: Used to develop the frontend web interface for real-time
  monitoring and displaying detected alerts.
  Flask: A lightweight Python web framework used to create APIs and serve data from the
  backend to the frontend.
  YOLO (You Only Look Once): A deep learning algorithm for real-time object detection,
  used here for more accurate face detection.
  Facenet: A deep convolutional neural network used for face recognition, comparing input
  faces with known faces in the database.
  MongoDB: A NoSQL database used to store images, user details, timestamps, and detection
  records in a flexible JSON-like format.
  MongoDB Compass: GUI for MongoDB used to visualize, query, and manage stored
  surveillance data effectively.
  Flask APIs: Used to fetch real-time data from the backend and deliver it to the frontend
  securely.
  SMTP (Simple Mail Transfer Protocol): Used to send email alerts to administrators when
  a threat is detected.
                                                18
                                         CHAPTER 7
7. IMPLEMENTATION
        The integration of surveillance cameras is a critical first step in the system’s operation.
  In this project, two types of cameras are utilized: the laptop's built-in webcam and a mobile
  phone camera connected through a data cable. OpenCV, a widely used computer vision
  library, is employed to capture real-time video streams from these cameras. The system is
  designed to handle multiple camera feeds, ensuring seamless integration for continuous
  surveillance. The video data is fed into the system, where it can be processed for face
  detection and recognition. This multi-camera approach provides comprehensive coverage and
  allows the system to monitor different areas concurrently.
        The process begins by ensuring proper camera configuration, allowing the video feed
  to be captured at an optimal frame rate. The surveillance system works by feeding the camera
  input directly to a processing unit that can analyze the video in real time. This integration
  enables the system to detect motion, monitor surroundings, and, most importantly, detect
  faces in the live feed, forming the foundation for further stages like face recognition. The
  ability to incorporate both a laptop camera and a mobile phone camera ensures that the system
  remains flexible and scalable.
                                                19
                     FIG 7.1 SURVEILLANCE CAMERA INTEGRATION
        Face detection and recognition are fundamental components of this system, enabling it
 to identify individuals from the video footage. For face detection, the system uses Haar Cascade
 and YOLO (You Only Look Once) algorithms. Haar Cascade is used due to its efficiency in
 detecting faces in various orientations, while YOLO provides real-time object detection with
 high accuracy. Once a face is detected, the system processes it for recognition by comparing it
 with images stored in the MongoDB database. Each recognized face corresponds to a thief’s
 details, such as their name, image, and location.
        The face recognition system works by extracting facial features and comparing them to
 the dataset of known thief images stored in the database. This comparison is carried out using
 machine learning models that have been trained to recognize unique facial features. If a match
 is found, the system triggers the next step of the process—alerting the administrator. The
 system is optimized for real-time performance, ensuring that face detection and recognition
 happen with minimal delay, which is crucial for surveillance purposes. This technology ensures
 a swift response to any detected security threat, offering a high level of accuracy in identifying
 individuals.
                                                20
                  FIG 7.2 FACE DETECTION AND RECOGNITION
        Database connectivity is vital for storing and retrieving the data required by the
 surveillance system. MongoDB serves as the backend database for this project due to its
 flexibility and scalability. The system is designed to store various types of data, including
 images of known thieves, their associated details, timestamps of incidents, and geographic
 location information. The database is integrated with Flask, which acts as the backend
 framework for the application. Through Flask’s API, the system can access and modify data
 stored in MongoDB, allowing real-time interaction with the surveillance feed.
        When a face is detected and recognized, the system queries the MongoDB database to
 retrieve the thief’s details, including their identity, location, and prior incident records. This
 information is essential for notifying the admin and making informed decisions. MongoDB’s
 NoSQL nature ensures that the system can efficiently store unstructured data, such as images
 and location data, while also supporting quick retrieval of this information when a match is
 found. The seamless integration between Flask and MongoDB ensures smooth operation of the
 surveillance system, with quick access to necessary data for decision-making.
        The system maintains a log of all recognition events in the database, creating a
 searchable history for future reference and analysis. This archival capability is crucial for
                                                21
  pattern identification and long-term security planning. The database schema is designed to
  accommodate new entries dynamically, making it easy to update or expand the list of known
  individuals. By enabling efficient data handling and retrieval, MongoDB plays a central role in
  ensuring the responsiveness and reliability of the overall surveillance system.
         The alert system is a crucial feature of the project, ensuring that administrators are
  promptly informed when a security breach occurs. Upon detecting a recognized thief, the
  system automatically sends an email alert to the designated recipients. This is achieved using
  Flask’s integration with Python’s Simple Mail Transfer Protocol (SMTP) library. The email
  contains essential details such as the thief's image, location of detection, timestamp, and
  additional relevant data that will aid the admin in taking immediate action. The email
  notifications are designed to be automated, requiring no manual intervention, thus ensuring
  rapid and reliable communication.
         The use of SMTP ensures secure and efficient email delivery, with error handling
  mechanisms in place to manage any potential delivery failures. The system allows multiple
  email addresses to be added to the alert list, ensuring that alerts are received by all relevant
  personnel. This feature is particularly useful in large-scale surveillance systems where multiple
  admins or security personnel may need to be notified in real time. By integrating email alerts
                                                 22
 into the system, administrators can take swift action in case of any detected threats, improving
 the overall security response time and effectiveness.
        The alert system is customizable, allowing administrators to set priority levels for
 different types of detections, such as high-priority alerts for known suspects. It also maintains
 a log of all sent emails within the database for record-keeping and future reference. This
 historical alert data can later be used for pattern analysis or reporting purposes. The real-time
 nature of the email alerts bridges the gap between detection and action, minimizing delay in
 responding to potential threats. Overall, this system ensures proactive security management,
 reducing reliance on manual monitoring.
                                                23
interface is dynamic, displaying the detected thief's image, name, location, and the time of
detection, all in an organized and easy-to-read format. The admin interface is designed to be
intuitive, with clear visual cues for alerts and system statuses.
          In addition to real-time monitoring, the web interface also provides access to historical
data, allowing admins to review past incidents and the corresponding alerts. This feature is
crucial for tracking patterns and analyzing security threats over time. The interface is connected
to the MongoDB database, fetching the necessary data for display, such as thief images and
incident records. By using a web-based platform, the system ensures that administrators can
access and manage the surveillance data from anywhere, as long as they have an internet
connection, making it a flexible and scalable solution for monitoring and responding to security
events.
          The web interface serves as a centralized dashboard for administrators to monitor real-
time surveillance activity and manage alerts efficiently. Built using HTML, CSS, and
JavaScript, the interface displays live video streams from the connected cameras and
automatically updates with information whenever a thief is detected. It shows the recognized
individual’s image, name, detection time, and geographic location, all pulled dynamically from
the MongoDB database. The interface is designed to be simple and responsive, enabling quick
access to critical data and allowing admins to act promptly from any device with internet
access. This enhances the system's usability and ensures continuous monitoring and control.
                                                 24
                                             CHAPTER 8
8.MODULES
        The Face Detection Module is responsible for identifying human faces from live camera
 feeds. It uses computer vision algorithms such as Haar Cascade and YOLO (You Only Look
 Once) to detect facial patterns and features accurately. These models are trained to detect faces
 under varying lighting conditions and angles, ensuring reliable detection in real-time scenarios.
 The detection process begins as soon as the video stream is initiated from the surveillance
 cameras.
        Haar Cascade is employed for its lightweight and fast performance, ideal for basic
 detection tasks. YOLO, on the other hand, offers higher accuracy and the ability to detect
 multiple faces in a single frame. Together, these models form a strong detection system that
 balances speed and precision. The detected faces are cropped and passed to the next module
 for recognition.
        This module plays a foundational role in the overall system by ensuring only human
 faces are processed, filtering out irrelevant data. It also logs detection timestamps and frame
 information, helping in further analysis and record keeping. By focusing solely on face
 patterns, it reduces computational overhead and increases the efficiency of the entire
 recognition pipeline.
        The Face Detection Module is the initial and crucial part of the Facenet Surveillance
 System. It captures video frames from a live webcam or mobile camera in real-time. Using
 OpenCV’s Haar cascade classifier or YOLO algorithm, the system scans each frame to detect
 human faces with high speed and accuracy. This module draws bounding boxes around detected
 faces, marking them for further processing. It handles various lighting conditions and angles to
 ensure reliable detection. The detected face region is then passed to the recognition module for
 identification. This module runs continuously and efficiently to ensure no face goes unnoticed.
 It plays a key role in triggering the rest of the system’s functions such as recognition, alerting,
 and display.This module runs continuously and efficiently to ensure no face goes unnoticed. It
 plays a key role in triggering the rest of the system’s functions such as recognition, alerting,
 and display. The algorithm has been optimized to reduce false positives and increase the speed
 of detection.
                                                 25
8.2 FACE RECOGNITION MODULE
            The Face Recognition Module takes the output from the detection module and matches
 it with known identities in the database. It extracts unique facial features and compares them
 with stored data using embedding-based models like FaceNet. If a match is found, the
 individual is identified and associated details like name, image, and ID are retrieved. This
 process is optimized for real-time performance.
            This module ensures accurate identification and reduces false positives by using robust
 comparison techniques. In case of a match, the module passes the information to the alert and
 database systems for further action. It is also capable of updating recognition logs, which are
 valuable for security audits and monitoring system performance.
            The Face Recognition Module is responsible for identifying the detected face by
 comparing it with stored faces in the database. Once a face is detected in a video frame, it is
 cropped and converted into a facial embedding using a deep learning model such as FaceNet.
 These embeddings are numerical vectors that represent unique facial features. The system then
 compares this embedding with those stored in the MongoDB database to find a match. If a
 match is found, the corresponding thief or suspect details are retrieved.
            The recognition process is highly accurate and works well even with partial visibility
 or slight variations in appearance. The module supports real-time processing, ensuring that
 identification happens within seconds of detection. It also includes threshold checks to avoid
 false matches and ensure high precision. In the case of an unknown face, the system can
 optionally store the new face for future reference. This module acts as the brain of the
 surveillance system, linking visual input to identity data. The process is completely automated
 and requires no manual intervention. Recognition logs are maintained for each match for future
 verification. The accuracy and speed of this module play a vital role in the effectiveness of the
 entire system.
                                                   26
8.3 REAL-TIME VIDEO PROCESSING
         This module manages the continuous capture and processing of video frames from
  connected surveillance cameras. It uses OpenCV to stream and process frames in real time,
  ensuring the system remains responsive and efficient. The video feed serves as the source for
  both face detection and recognition. Each frame is analyzed individually to detect faces while
  maintaining a smooth video experience.
         Additionally, the module supports frame logging and image capture for later review or
  database storage. By combining speed and accuracy, the Real-Time Video Processing Module
  acts as the operational core of the surveillance system. It ensures that all other modules receive
  timely and relevant visual data for analysis and action.
                                                 27
8.4 ALERT AND NOTIFICATION MODULUE
        Once a thief is recognized, the Alert and Notification Module is triggered to inform
 designated administrators. It uses Python’s SMTP protocol to send automatic email alerts,
 which include the thief’s image, location, and time of detection. This prompt alerting
 mechanism ensures that action can be taken quickly to prevent potential threats.
        The module supports multiple recipients and formats messages in a clear, informative
 manner. Email alerts are generated only when a face is recognized to avoid spam or false
 notifications. The system ensures that each notification is logged and time-stamped for future
 reference and tracking.
        The Alert and Notification Module plays a vital role in ensuring that immediate action
 is taken once a suspect is identified. When a match is found between a detected face and a
 stored suspect, the system triggers an alert to notify the admin. The module sends an email
 containing the captured image of the suspect, along with their details and the location of the
 detection. Using SMTP, the system ensures fast and reliable delivery of alert emails to
 predefined addresses. This real-time alerting capability ensures that administrators can take
 swift action in response to potential security threats. The module operates in sync with the face
 recognition and video processing systems to guarantee timely responses.
        In addition to email alerts, the module can be extended to send notifications through
 other channels like SMS or mobile push notifications in the future. It also maintains a log of
 all alerts sent, including timestamps and details of the detected individuals. This allows for easy
 tracking of events and provides an audit trail for security purposes. The integration of this
 module with the web interface further enhances the user experience, as admins can receive
 visual updates in addition to email alerts. Overall, this module is essential for improving the
 responsiveness and effectiveness of the surveillance system.
                                                 28
8.5 WEB INTERFACE MODULE
        The web interface also includes features for managing system settings, such as email
 configurations, camera preferences, and alert thresholds. It allows the admin to view historical
 detection data and access logs for further analysis or investigation. Built with security in mind,
 the interface ensures that only authorized users can access sensitive information and system
 controls. It is designed for scalability, allowing future features such as multi-camera support
 and advanced analytics to be integrated seamlessly. The interface is intuitive and user-centric,
 making it easy for even non-technical users to interact with the system effectively. By providing
 detailed visualizations and control, this module enhances the overall functionality of the
 Facenet Surveillance System. The web interface also features a dashboard for quick overview,
 displaying key metrics such as the number of alerts and the status of connected cameras. It
 allows administrators to easily manage multiple surveillance feeds from different locations,
 ensuring comprehensive monitoring. Additionally, the interface is optimized for both desktop
 and mobile views, providing flexibility for administrators to monitor the system on the go.
                                                29
                                        CHAPTER 9
9.TESTING
1. Unit Testing
          Unit testing involves testing individual components or functions of the code in isolation.
  In your project, this includes testing functions like face detection, email alert trigger, or
  database insert functions. It ensures that each block of code works as expected without
  depending on other modules.
2. Integration Testing
          Integration testing checks how multiple modules work together. For your system, it
  verifies that the face detection output is properly passed to the recognition module, and that
  recognized faces trigger alerts and update the web interface correctly. It ensures smooth
  communication between components like OpenCV, MongoDB, and Flask.
3. System Testing
         System testing evaluates the complete, integrated system to check if it meets the project
  requirements. It includes checking camera input, face recognition accuracy, database updates,
  web display, and alert emails—all in one workflow. It simulates real-world use and ensures the
  system functions as a whole.
       UAT is performed to check whether the system is usable and effective for the end users
  (like admins). In your case, this tests whether the admin can view alerts properly, access the
  web interface easily, and get timely notifications. It ensures the system is ready for deployment
  in real-time scenarios.
5. Performance Testing
          Performance testing checks how the system performs under load or stress. For example,
  how fast the system detects and recognizes faces, and how quickly alerts are sent when multiple
  faces appear. This helps in identifying delays or bottlenecks during high activity.
                                                 30
6. Regression Testing
          Regression testing ensures that new changes or updates in the code don’t break existing
  functionality. If you add a new alert feature or improve the UI, this testing verifies that earlier
  modules like detection and database still work properly.
7. Security Testing
          Security testing ensures that data in the system is protected. In your project, it includes
  checking that thief images and personal details stored in MongoDB are safe from unauthorized
  access. It also ensures the email system isn’t vulnerable to misuse.
  Test Case: Verify whether the system accurately detects human faces from live video input
  using webcam or mobile camera.
Expected Result: The system should detect and highlight the face region with a bounding box.
Test Result: Successfully detects various faces under normal lighting conditions.
  Test Case: Check if the system correctly matches detected faces with stored images in
  MongoDB.
Expected Result: Recognized faces should be displayed with correct name and details.
Test Result: Accurately recognizes known faces; unknown faces are not matched.
  Test Case: Ensure that the application can fetch and store thief data and images in MongoDB
  properly.
  Expected Result: Data should be added, retrieved, and updated in the MongoDB collection
  without errors.
                                                  31
4. Alert System Test
Test Case: Validate whether the system sends an email alert when a thief is detected.
Expected Result: Email should contain thief image, location, and time of detection.
Test Result: Alerts are successfully triggered and sent to both admin email addresses.
  Test Case: Check if the web interface displays live feed, detection updates, and alert details
  correctly.
Expected Result: Admin should see real-time updates, images, and details in the dashboard.
Test Result: Web interface loads and updates content dynamically without delay.
          The face recognition accuracy may vary in low-light environments or with partially
  covered faces. In such cases, the system might fail to recognize the individual or misidentify
  them. Future improvements can include adding infrared camera support or integrating image
  enhancement techniques for night vision.
          Another limitation is the system’s dependency on a stable internet connection for web-
  based updates and email alerts. Offline operation may disrupt the alerting process.
  Implementing SMS-based alerts or a local desktop notification system could improve offline
  performance.
          The system currently supports only two cameras, which limits the scalability in large
  surveillance environments. In the future, multi-threading and distributed video processing can
  be introduced to support more cameras across different locations simultaneously.
          Although the system functions effectively in most cases, it may experience delays when
  processing high-resolution video streams in real time, especially on low-performance devices.
  This can lead to lag in face recognition or slow alert generation. Optimizing the video
  processing pipeline and using GPU acceleration could enhance performance significantly.
  Another improvement would be implementing advanced machine learning models like
  FaceNet or DeepFace for more accurate recognition. Currently, the system does not store
  detection logs for future analysis. Adding a logging module to save timestamps, locations, and
                                                32
recognized identities would be beneficial. This can also help generate analytical reports on
theft-prone zones and activity patterns.
       Lastly, the alert system is limited to emails. Admins might miss alerts if not constantly
checking their inbox. Expanding the alert system to mobile push notifications or integrating it
with platforms like WhatsApp or Telegram could significantly enhance real-time
responsiveness.
       While the Facenet Surveillance System provides real-time face detection and
recognition, it has certain limitations that can be improved. The accuracy of face recognition
can be affected by poor lighting conditions or variations in the angle of the face, which may
lead to false positives or missed detections. Additionally, the system is dependent on the quality
of the camera, and lower-resolution cameras may reduce the accuracy of both detection and
recognition. The current system can handle a limited number of faces and is not designed for
large-scale deployment with multiple cameras. Moreover, the facial recognition speed might
slow down with higher numbers of people in the frame or complex backgrounds. For
improvement, incorporating advanced deep learning models like CNNs (Convolutional Neural
Networks) or transfer learning could enhance the system’s accuracy and speed. The system
could also be expanded to support more camera feeds and handle larger databases of facial
images. Additionally, integrating face recognition under various environmental conditions and
improving GPS-based location accuracy would enhance overall performance. Implementing
multi-modal authentication methods like voice or fingerprint recognition could also be
explored for higher security. Regular updates to the database and algorithms will help maintain
the system’s reliability and adaptability in dynamic environments.
                                               33
                                           CHAPTER 10
        The web interface displays real-time CCTV footage from the connected surveillance
 camera. It automatically highlights and tags any detected face using a red bounding box. When
 a match is found with a known thief, their image, name, location, and timestamp appear on the
 screen. The interface is user-friendly and enables seamless monitoring by the admin.
        Details are pulled from the database and shown in a structured format on the right panel.
 This ensures quick decision-making and improves the system’s response to threats. These
 System Gives Detailed information about the Application.
                                               34
10.2 EMAIL ALERTS AND NOTIFICATION
          The email alert is instantly triggered once a thief is detected by the system. It contains
  vital information such as the thief’s name, image, time of detection, and location. This email is
  sent to two predefined admin addresses for immediate action. The format is clear and simple,
  allowing for quick understanding and verification. It includes an image attachment showing
  the detected face for easy identification. This notification system ensures that the authorities
  are promptly informed.
       The email alert notification output is a crucial feature of the Facenet Surveillance System,
  providing real-time updates to administrators upon detecting a match. When a face is
  recognized, the system sends an email with the suspect's image, name, and geographical
  location. The email also includes the timestamp of the detection and a brief description of the
  detected event. Using SMTP, the email is delivered reliably to the designated recipient
  addresses, ensuring prompt notification. The email output ensures that administrators are
  immediately informed, allowing them to take appropriate action without delay.
                                                 35
                                          CHAPTER 11
11.CONCLUSION
         The Facenet Surveillance System is a real-time face recognition and alert system
 designed to detect and identify thieves using CCTV footage. The project utilizes MongoDB for
 storing thief details, including images, locations, and timestamps. The system integrates with
 a Flask backend and uses Haar Cascades and YOLO for face detection, with OpenCV for video
 processing. Upon detecting a thief's face, the system sends email alerts with the individual's
 details and geographic location. The project supports surveillance using both a laptop webcam
 and a mobile phone camera, with real-time alerts displayed on a web interface.
         The Facenet Surveillance System provides a robust solution for real-time face detection
 and recognition, enhancing security through automated alerts and notifications. It integrates
 video processing, face recognition, and database management to identify suspects quickly and
 efficiently. The system is designed to work in real-time with minimal latency, ensuring timely
 action when a match is found. With the ability to send email alerts containing suspect details
 and location, it significantly improves security monitoring. The combination of these features
 makes the system a reliable tool for surveillance and threat detection.
         Future enhancements for the Facenet Surveillance System include incorporating multi-
camera support to enable simultaneous monitoring from multiple locations. Improved face
recognition algorithms, such as deep learning-based models, could be integrated to enhance
detection accuracy. The system could incorporate motion detection features to trigger alerts only
during suspicious activities. An advanced data analytics dashboard could be added to visualize
patterns, such as theft-prone areas. Additionally, integrating voice alerts for real-time notification
could improve the system's responsiveness. Finally, a mobile app version of the system could be
developed for easier access and monitoring on the facenet surveillance system
                                                  36
                                        CHAPTER 12
12.APPENDIX
import os
import cv2
import numpy as np
# Flask Application
app = Flask(__name__)
CAPTURED_IMAGE_DIR = "static/captured/"
os.makedirs(CAPTURED_IMAGE_DIR, exist_ok=True)
 face_cascade              =          cv2.CascadeClassifier(cv2.data.haarcascades   +
 "haarcascade_frontalface_default.xml")
def recognize_faces():
while True:
if not ret:
break
                                                37
     gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
thief_name = "Unknown"
break
cap.release()
cv2.destroyAllWindows()
# Flask Routes
@app.route('/')
def index():
return render_template('index.html')
@app.route('/alerts')
def alerts():
thieves = fetch_thief_details()
                                             38
    @app.route('/start_recognition', methods=['POST'])
def start_recognition():
recognize_faces()
if __name__ == "__main__":
app.run(debug=True)
import smtplib
# Email Configuration
SENDER_EMAIL = "mathanraj.mp2003@gmail.com"
EMAIL_PASSWORD = "Mathan.45@"
    RECEIVER_EMAILS                        =                ["mathanraj.mp2003@gmail.com",
"mathanrajrohit@gmail.com"]
       body = f"Alert! {thief_name} detected at {location}. Check the surveillance system for
details."
msg = MIMEMultipart()
msg["From"] = SENDER_EMAIL
msg["Subject"] = subject
msg.attach(MIMEText(body, "plain"))
try:
                                               39
    server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(SENDER_EMAIL, EMAIL_PASSWORD)
server.quit()
except Exception as e:
if __name__ == "__main__":
# Example usage
<!DOCTYPE html>
<html lang="en"
                                              40
12.2 DATABASE COLLECTION AND SAMPLE ENTRIES
         The database for the Facenet Surveillance System stores key details about detected
thieves, including images, their personal information, location, and timestamps of incidents. This
information is stored in MongoDB, with the collection named thief_details in the
thief_detection_db database. Each entry in the collection includes crucial data such as the thief's
name, a corresponding image file path, the geographical location where the theft occurred, and
a timestamp to track when the incident took place. The database allows quick retrieval and
comparison of facial data for real-time detection. Mongodb Stores the datas in Unstructured
format easy for fetching. The system uses these entries to match faces from surveillance footage,
sending alerts when a match is found. Below is a sample of the entries stored in the collection:
Sample Entries:
"image_path": "C:/Images/john_doe.jpg",
"timestamp": "2025-04-16T08:30:00"
"image_path": "C:/Images/jane_smith.jpg",
"timestamp": "2025-04-16T10:45:00"
                                                 41
                                          REFERENCES
[1] Wang, L., & Han, X. (2024). "Surveillance Systems Using Deep Learning-Based Face
[2] Xu, X., & Wei, H. (2023). "Enhancing Face Recognition with Deep Learning Models for Real-
[3] Hu, W., & Li, X. (2023). "Surveillance System Using FaceNet and YOLO for Real-Time
[4] Yang, L., Zhang, H., & Cheng, Y. (2021). "Real-Time Face Recognition Using Deep Learning
[5] Zhang, L., & Zhang, D. (2021). "Facial Recognition System for Security Surveillance: A
[6] Zhou, P., & Xiao, J. (2021). "Deep Learning for Real-Time Surveillance in the Education
[7] Masi, I., Rawls, A., & Shen, X. (2021). "Deep Face Recognition: A Survey." IEEE Transactions
[8] Ranjan, R., & Patel, V. M. (2021). "Hyperface: A Deep Learning Approach for Face Detection
[9] Zhu, Z., & Ramanan, D. (2020). "Face Detection, Pose Estimation, and Landmark Localization
[10] Zhao, L., & Xie, Y. (2020). "Automatic Face Recognition for Surveillance and Security
                                                42
[11] Taigman, Y., Yang, M., Ranzato, M., & Wolf, L. (2020). "DeepFace: Closing the Gap to
[12] Schroff, F., Kalenichenko, D., & Philbin, J. (2020). "FaceNet: A Unified Embedding for Face
Recognition and Clustering." Proceedings of the IEEE Conference on Computer Vision and
Pattern Recognition.
[13] Parkhi, O. M., Vedaldi, A., & Zisserman, A. (2020). "Deep Face Recognition." Proceedings
[14] Huang, G. B., Mattar, M., & Berg, T. (2020). "Labeled Faces in the Wild: A Database for
[15] Mothukuri, S., & Vemuri, M. (2020). "FaceNet-Based Surveillance System Using Deep
                                                43
44
45
46