🔒
International Peer-Reviewed Publisher
Serving Researchers Since 2012

Real-Time Crowd Density Monitoring and Stampede Prevention Using Computer Vision and Deep Learning

DOI : https://doi.org/10.5281/zenodo.19692539
Download Full-Text PDF Cite this Publication

Text Only Version

Real-Time Crowd Density Monitoring and Stampede Prevention Using Computer Vision and Deep Learning

Deepa Bendigeri

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Varsha S Jadhav

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Chandana Ambadagatti

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Ashwini Ashok Hegde

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Shreya R Patil

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Rizwan Ganadari

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Prajwalgouda Karigoudar

Information Science and Engineering SDM College of Engineering and Technology Dharwad, India

Abstract – This paper presents a smart surveillance-based approach for crowd management and stampede prevention using computer vision and artificial intelligence techniques. Large public gatherings such as festivals, sports events, and religious celebrations often lead to overcrowding, which can result in dangerous situations and loss of human lives. Traditional monitoring methods rely mainly on manual observation of surveillance cameras, making it difficult for authorities to identify risk conditions in advance. The proposed system aims to automatically monitor crowd density and detect abnormal crowd behavior in real time using intelligent video analysis. Video streams captured through CCTV or mobile cameras are processed using deep learning-based object detection techniques to identify and count individuals within a defined region. The system estimates the maximum safe capacity of the monitored area and continuously compares it with the detected number of people to determine whether overcrowding is occurring. In addition to density estimation, the system analyzes crowd motion patterns to identify unusual activities such as sudden rushing, pushing, or panic movement that may lead to stampede situations. Person tracking algorithms are used to monitor movement patterns and improve the accuracy of crowd analysis. When the system detects overcrowding or abnormal behavior, warning alerts are generated to notify security personnel so that preventive actions can be taken immediately. The proposed approach provides an efficient early warning mechanism for

authorities to manage large gatherings more effectively and enhance public safety.

Keywords – Crowd Management, Stampede Prevention, Computer Vision, Crowd Density Estimation, Deep Learning, Smart Surveillance System.

  1. INTRODUCTION

    Crowd management has become an important public safety challenge in modern societies, especially in countries with a large population and frequent mass gatherings. Events such as religious festivals, sports celebrations, political rallies, concerts, and cultural programs attract thousands of people into limited spaces. When the number of individuals exceeds the safe capacity of a location, movement becomes restricted and dangerous situations such as overcrowding, panic behaviour, and stampedes may occur. Several tragic incidents in recent years have highlighted the serious consequences of uncontrolled crowd movement. Large gatherings during celebrations and public events have occasionally resulted in stampede situations that caused injuries and loss of life. In many cases, authorities were unable to predict these situations in advance and were forced to respond only after

    overcrowding had already occurred. This delay in detection makes it difficult to control the situation effectively. Traditional crowd monitoring systems mainly depend on manual observation through CCTV cameras. Security personnel are required to continuously monitor multiple video feeds to identify potential risks. However, human monitoring can be inefficient when large areas are involved, and it becomes difficult to detect overcrowding or abnormal crowd behaviour in real time. Advancements in artificial intelligence and computer vision technologies have opened new possibilities for improving surveillance systems. Intelligent monitoring systems can automatically analyse video streams, detect the presence of individuals, and estimate crowd density in a specific region. These technologies can also identify unusual movement patterns such as sudden rushing, pushing, or chaotic motion that may indicate the early stages of panic. The aim of this project is to develop a smart surveillance system for crowd management and stampede prevention using computer vision techniques. The proposed system integrates CCTV or mobile cameras with an intelligent video analysis framework that continuously monitors crowd activity. The system first determines the maximum capacity of the monitored region and then counts the number of people present in that area. If the number of individuals approaches or exceeds the safe capacity limit, the system generates alerts for security personnel. In addition to crowd counting, the system also analyses crowd movement patterns to detect abnormal actions such as pushing or aggressive movement among individuals. When such behaviours are detected, the system immediately generates an alert so that authorities can take preventive measures. By providing real-time monitoring and early warning signals, the proposed system aims to assist authorities in maintaining crowd safety and preventing dangerous situations during large gatherings.

  2. LITERATURE SURVEY

    Penna et al. [1] presented a stampede monitoring and pre- alarm system using computer vision techniques based on the ViolaJones face detection algorithm. The system detects human faces from surveillance footage and estimates crowd density by counting detected faces. When the count exceeds a predefined threshold, alerts are generated through GSM and email communication. The study demonstrated that the system is computationally efficient and suitable for real-time applications. However, its reliance on frontal face detection and sensitivity to lighting conditions limit its performance in highly dense and occluded environments.

    Fu et al. [2] proposed a Naïve Bayes Classifier-based early warning model for predicting stampede risks in large-scale public gatherings. The model incorporates multiple risk factors, including environmental conditions, crowd density, and management parameters, to classify risk levels. The results showed high accuracy in detecting risk scenarios using probabilistic classification. However, the assumption of feature independence and dependency on manually collected datasets restrict the models adaptability in dynamic real- world situations.

    Jalaja and Deeksha [3] introduced a smart event management system integrating Internet of Things (IoT), Artificial

    Intelligence (AI), and Big Data analytics for large-scale gatherings. The system utilizes IoT sensors and AI algorithms to monitor crowd density and predict congestion hotspots in real time. The study demonstrated improved resource allocation and proactive decision-making. However, challenges such as data privacy concerns, high implementation cost, and lack of standardized frameworks were identified.

    Singh and Tripathi [4] proposed a comprehensive crowd management framework combining IoT, AI, and Geographic Information Systems (GIS) for large-scale events. The framework includes real-time monitoring, route optimization, zoning strategies, and emergenc response mechanisms. The study highlighted improvements in crowd control efficiency and safety. However, the proposed system is largely conceptual and lacks real-time experimental validation.

    Yamuna et al. [5] developed an AI- and machine learning- based crowd monitoring system using CCTV surveillance. The system employs YOLO-based object detection and tracking algorithms to analyze crowd density and detect abnormal activities. It also incorporates predictive analytics for crowd behavior forecasting. While the system improves automation and reduces human error, it depends heavily on high-quality video input and computational resources.

    Kanaujiya and Tiwari [6] conducted a comprehensive study on crowd management and surveillance strategies during large- scale gatherings such as the Kumbh Mela. The study emphasized the use of advanced technologies, including drones, GIS, RFID, and integrated command centers, for real- time monitoring. It highlighted the importance of coordination and planning in crowd management. However, the study is primarily descriptive and lacks quantitative validation.

    Jayaraj et al. [7] proposed a deep learning-based crowd behavior recognition system using a hybrid CNN-LSTM architecture. The model captures both spatial and temporal features to detect abnormal activities such as stampedes and fights. The system achieved high accuracy and low latency, making it suitable for real-time applications. However, it requires large annotated datasets and high computational power.

    Cob-Parro et al. [8] introduced a real-time stampede detection system using optical flow and entropy-based feature extraction. The system employs a stacking classifier combining Support Vector Machine (SVM) and Random Forest (RF) for classification. Experimental results showed improved accuracy and processing speed compared to existing methods. However, the system performs less effectively in highly dense crowd scenarios.

    Divya et al. [9] proposed an AI-based crowd stampede prevention system using YOLOv8 for real-time object detection and crowd density estimation. The system classifies risk levels and generates alerts based on crowd behavior analysis. It also includes heatmap visualization and multi- camera integration. However, the systems performance is influenced by environmental factors such as lighting and occlusion.

    Penna et al. [10] further explored classical computer vision approaches for crowd monitoring using Haar cascade classifiers. The system demonstrated efficient real-time detection and alert generation. However, it is limited by fixed

    threshold values and reduced robustness in complex environments.

    Verma and Mittal [11] proposed a real-time stampede detection system using deep learning and distributed edge computing. The system integrates CNN-based feature extraction with optical flow analysis and machine learning classifiers. Experimental results on UMN and PETS datasets showed high accuracy and improved real-time performance. However, challenges related to computational complexity and synchronization in distributed systems were identified.

    Qaraqe et al. [12] introduced Public Vision, a secure smart surveillance system for crowd behavior recognition using a Swin Transformer-based deep learning model. The system classifies crowd behavior based on size and violence level and incorporates a three-layer architecture with secure data transmission using DMVPN and IPSec. Experimental results demonstrated high accuracy and real-time performance. However, the system requires significant infrastructure and computational resources for large-scale deployment.

  3. METHODOLOGY

    The proposed Crowd Management and Stampede Prevention System is designed to monitor public spaces and detect dangerous crowd situations using computer vision and artificial intelligence techniques. The main objective of the system is to automatically analyze crowd density and human movement patterns in real time so that early warning signals can be generated before a potentially dangerous situation develops. The overall workflow of the system is represented in Fig. 1, which illustrates the different stages involved in monitoring, analyzing, and generating alerts for crowd control.

    The system begins with the initialization of the surveillance module and activation of the video processing unit. During this stage, the system establishes communication with the available video sources such as CCTV cameras, IP cameras, or mobile cameras installed in the monitored location. These cameras are positioned at strategic points to ensure that the entire region of interest is clearly visible. The video streams captured by these devices provide continuous visual information about crowd activity in the monitored environment. Once the cameras are connected, the system starts capturing video frames at regular intervals and forwards them to the processing module for analysis.

    In the next stage, the captured video frames are processed using advanced computer vision techniques to identify individuals present in the scene. For this purpose, the system uses the YOLOv8 object detection model, which is a deep learning- based algorithm capable of detecting objects in real time with high accuracy. YOLOv8 analyzes each video frame and identifies human figures present in the image by generating bounding boxes around them. Each bounding box represents a detected individual along with a confidence score indicating the accuracy of the detection. This process enables the system to automatically detect multiple individuals even in moderately crowded environments. The ability of YOLOv8 to process images quickly makes it suitable for real-time surveillance applications where continuous monitoring is required.

    After the individuals are detected within the video frames, the system proceeds to track their movement across consecutive frames. Tracking is necessary to ensure that the same

    individual is not counted multiple times and to analyze the movement behavior of each person in the crowd. For this purpose, the system employs the Deep SORT tracking algorithm, which is a widely used technique for real-time object tracking. Deep SORT assigns a unique identification number to every detected person and maintains this identity across multiple frames of the video. By associating detected objects between frames, the algorithm can track the trajectory and movement direction of individuals as they move within the monitored region. This tracking information provides valuable insights into how people are moving and interacting within the crowd.

    Once the tracking process is completed, the system calculates the total number of individuals present within a predefined Region of Interest (ROI). The ROI represents the specific area that needs to be monitored for crowd density, such as an entrance gate, corridor, or gathering space. By counting the number of detected individuals within this region, the system can estimate the current crowd density in that particular location. The crowd density value is then compared with the maximum safe capacity defined for the monitored area. The safe capacity threshold is determined based on the physical size of the region and the recommended safety guidelines for crowd management. This comparison helps determine whether the number of people present in the area is within safe limits or approaching a potentially dangerous level.

    As shown in Fig. 1, the system evaluates the crowd density by comparing the detected number of individuals with the predefined capacity threshold. If the number of people exceeds the safe capacity limit, the system identifies the situation as overcrowding. Overcrowding is considered one of the primary causes of stampede incidents because it restricts the movement of individuals and increases the likelihood of panic situations. When overcrowding is detected, the system immediately generates alert notifications and sends them to security personnel or authorities responsible for crowd management. These alerts cn be transmitted through warning messages, alarms, or monitoring dashboards. By receiving these alerts in advance, authorities can take preventive actions such as restricting entry into the area, redirecting the flow of people, or opening additional exit routes to reduce crowd pressure.

    If the crowd density remains within safe limits, the system continues to monitor the movement and behavior of individuals in the region. Monitoring crowd movement is important because dangerous situations may arise not only due to overcrowding but also due to sudden changes in crowd behavior. Therefore, the system performs motion analysis to understand how people are moving within the monitored area. By analyzing the direction and speed of movement of tracked individuals, the system can detect irregular crowd behavior patterns. For example, sudden increases in movement speed, chaotic motion patterns, or individuals pushing through the crowd may indicate the early stages of panic or disturbance.

    The system further analyzes these movement patterns to detect abnormal crowd behavior. Abnormal behaviors may include rapid crowd movement, sudden running, pushing, or unusual clustering of individuals in a specific region. Such behaviors are often observed during situations where panic begins to spread within a crowd. By identifying these abnormal patterns at an early stage, the system can predict potential risks and alert authorities before the situation escalates into a dangerous event.

    The detection of abnormal motion is an important component of the system because stampede incidents often occur when panic spreads rapidly among individuals in a crowded environment.

    When abnormal motion or panic behavior is detected, the system generates warning alerts similar to those produced during overcrowding situations. These alerts notify authorities that a potentially dangerous situation may develop if immediate action is not taken. The alerts generated by the system are displayed on a monitoring dashboard, which provides real-time information about crowd conditions. The dashboard may display important parameters such as the current number of people in the monitored area, crowd density levels, movement patterns, and detected risk levels. This information allows security personnel to quickly understand the situation and take appropriate actions to control the crowd.

    The monitoring dashboard plays an important role in assisting authorities in decision making. By observing real-time crowd statistics and alerts, security personnel can deploy additional staff, control entry points, or guide people toward safer exit routes. The dashboard can also be integrated with alarm systems or notification mechanisms to ensure that warnings are immediately communicated to the responsible authorities. In addition, the visual representation of data such as people counts, confidence level, and alert status makes it easier for operators to quickly understand the situation without requiring technical expertise.

    The entire system operates continuously and updates its analysis as new video frames are received from the cameras. As long as the surveillance system remains active, the video processing module continues to detect individuals, track their movements, evaluate crowd density, and monitor behaviour patterns. The system is designed to work efficiently in real- time environments, ensuring minimal delay between detection and alert generation. This rapid response capability is crucial in preventing dangerous situations from escalating.

    Whenever the system detects a potentially dangerous situation, it generates alerts and provides detailed information to help authorities respond quickly. These alerts include essential data such as the number of people detected, time of occurrence, and camera source, allowing for precise and immediate action. Furthermore, the integration of remote notification systems such as WhatsApp ensures that alerts are not limited to the dashboard but are also delivered directly to concerned personnel.

    Through this automated monitoring and alert mechanism, the proposed system aims to enhance public safety by reducing the risk of overcrowding and preventing stampede incidents during large public gatherings. It also minimizes the need for manual monitoring, thereby reducing human error and increasing efficiency in crowd management operations.

    Overall, the proposed system integrates multiple technologies such as real-time video surveillance, deep learning-based object detection, multi-object tracking, and behaviour analysis to create an intelligent crowd monitoring solution. By combining these technologies, the system is capable of detecting risk situations in advance and assisting authorities in managing crowds more effectively. Additionally, the system is scalable and can be deployed in various environments such as railway stations, stadiums, festivals, and shopping malls,

    making it a versatile solution for modern smart surveillance applications.

    Figure 1. Flowchart

    1. System Architecture

      The overall structure of the proposed crowd monitoring and stampede prevention system is illustrated in the System Architecture diagram. The architecture is organized into multiple functional modules that work together to monitor crowd activity, analyze video data, detect potential risks, and generate alerts when dangerous conditions are identified. The modular design allows the system to process real-time video streams efficiently while ensuring that each stage performs a specific task in the crowd monitoring pipeline.

      The system begins with the Video Input module, which acts as the primary source of visual information for the system. This module consists of surveillance devices such as CCTV cameras, IP cameras, or mobile cameras placed in the monitored environment. These cameras continuously capture video streams of areas where large gatherings are expected, such as entrances, public events, temples, railway stations, or stadiums. The captured video frames provide real-time information about crowd movement and density. These frames are transmitted to the next stage of the architecture, where intelligent processing takes place.

      The captured video data is then forwarded to the Processing Module, which performs the main analytical operations of the system. This module uses computer vision and deep learning

      algorithms to detect and analyze individuals present in the scene. The first stage of this module is the Person Detection component, which uses the YOLOv8 deep learning model to identify human figures within the video frames. YOLOv8 processes each frame and detects individuals by generating bounding boxes around them. This step enables the system to automatically identify multiple people within crowded environments with high accuracy.

      After detecting individuals in the frame, the system performs Person Tracking, which is implemented using the Deep SORT tracking algorithm. The purpose of this stage is to maintain the identity of each detected individual across multiple frames of the video stream. Deep SORT assigns a unique tracking ID to every person detected in the scene. By maintaining consistent tracking IDs, the system can observe how individuals move within the monitored area. This information helps prevent repeated counting of the same individual and enables the system to analyse movement patterns within the crowd.

      Following the tracking stage, the system performs Crowd Counting and Analysis. In this component, the total number of detected individuals within a defined region of interest is calculated. The system continuously updates this count as people enter or leave the monitored area. Based on this information, the system estimates the current crowd density of the region. This crowd density value becomes an important parameter for determining whether the environment is approaching unsafe crowd conditions.

      The processed crowd information is then transferred to the Alert and Monitoring Module, which evaluates the crowd condition based on predefined safety rules. This module continuously analyses the crowd density and movement behaviour of individuals in the monitored area. When the number of people exceeds the safe capacity of the region, the module generates an Overcrowding Alert. This alert indicates that the area has reached a critical crowd density level and that immediate crowd control measures may be required.

      In addition to density monitoring, the alert module also detects abnormal crowd behaviour. This includes irregular movement patterns such as sudden rushing, aggressive pushing, or chaotic motion within the crowd. These behaviours are often early indicators of panic situations that may lead to stampede incidents. When such abnormal patterns are identified, the system generates an Abnormal Behaviour Alert. By detecting these conditions early, the system allows authorities to respond before the situation escalates into a dangerous event. Once an alert is generated, the system proceeds to the Response Actions module, which is responsible for notifying authorities and initiating appropriate safety measures. This module communicates alert information to security personnel, police authorities, or event management teams. Notifications may be delivered through alarm signals, monitoring dashboards, or communication systems used by security staff. The response module also includes a Monitoring Dashboard, where real-time information about crowd conditions is displayed. The dashboard shows parameters such as the number of detected individuals, crowd density levels, and active alerts. Security personnel can use this information to quickly assess the situation and implement crowd control measures. If critical conditions are detected, the system may also support control and evacuation procedures. These actions

      may involve restricting further entry into the area, opening emergency exits, redirecting crowd flow, or deploying additional security personnel to manage the crowd safely. These response actions help minimize the risk of panic and reduce the likelihood of stampede incidents.

      Overall, the proposed system architecture integrates video surveillance technology with artificial intelligence-based analysis to provide an intelligent crowd monitoring solution. The interaction between the input module, processing module, monitoring module, and response module enables continuous observation of crowd activity and allows early detection of dangerous situations. This architecture supports real-time monitoring and fast response mechanisms, which are essential for ensuring public safety during large gatherings.

      Figure 2. System Architecture

    2. Algorithms used

      The proposed crowd management and stampede prevention system uses computer vision and deep learning algorithms to detect individuals, track their movements, and analyze crowd conditions in real time. The system mainly uses two important algorithms: YOLOv8 for person detection and Deep SORT for person tracking. These algorithms work together to monitor the crowd and detect potentially dangerous situations such as overcrowding or panic behavior.

      1. YOLOv8 for Person detection

        YOLOv8 (You Only Look Once version 8) is a modern object detection algorithm that can identify objects in images or videos quickly and accurately. In the proposed system, YOLOv8 is used to detect people in the video frames captured by surveillance cameras.

        How YOLOv8 Works:

        When a video frame is captured from the camera, it is first passed to the YOLOv8 model. The model uses a deep neural network to analyse the image and identify important visual patterns that represent objects. The algorithm scans the entire image at once and predicts bounding boxes around objects that it recognizes.

        Each bounding box contains two important pieces of information:

        The location of the object in the image

        The confidence score that indicates how certain the model is

        about the detection

        In this project, the model focuses mainly on detecting the person class. When people are detected in the frame, bounding boxes are drawn around them. This allows the system to visually mark every detected individual. For example, consider a temple entrance where many people are entering. When the camera captures a frame, YOLOv8 analyzes the image and detects each person standing in the scene. If there are 15 people in the frame, the algorithm generates 15 bounding boxes, each representing a detected individual. This information is then used by the system to estimate the total number of people in the monitored area.

        One of the major advantages of YOLOv8 is that it performs detection very quickly, which makes it suitable for real-time surveillance systems.

      2. Deep Sort for Person Tracking

    After people are detected in the video frame, the system must track their movement across multiple frames. This is done using the Deep SORT (Simple Online and Realtime Tracking) algorithm. Tracking is important because people continuously move within the scene. Without tracking, the system might detect the same person multiple times and count them repeatedly.

    How Deep SORT Works:

    Deep SORT assigns a unique ID number to every detected person. Once a person receives an ID, the system keeps track of that person as they move through the scene.

    The algorithm uses two main techniques to maintain tracking:

    1. Motion Prediction (Kalman Filter)

      The Kalman Filter predicts where a person will move in the next frame based on their previous position and movement direction.

    2. Object Matching (Hungarian Algorithm)

      The Hungarian algorithm matches newly detected objects with previously tracked individuals based on their position and appearance. By combining motion prediction and object matching, Deep SORT ensures that each person maintains the same ID across consecutive frames. Suppose a person enters the camera view and is assigned ID1. As the person walks across the monitored area, the tracking algorithm keeps following their movement. Even if the person moves from the left side of the frame to the right side, the system still recognizes them as ID 1 instead of counting them as a new person. This tracking mechanism helps the system analyse how people move inside the crowd.

    3. Crowd counting and density estimation

      Once individuals are detected and tracked, the system calculates the number of people present in the monitored region. This process is called crowd counting.

      How Crowd Counting Works:

      The system defines a Region of Interest (ROI) that represents the specific area where crowd density must be monitored. The bounding boxes produced by YOLOv8 represent detected individuals in the frame. The system counts the number of bounding boxes present inside the ROI to estimate the total crowd size. Consider a temple hall that can safely accommodate 200 people. If the system detects 180 people, the crowd density is still considered safe. However, if the number increases to 210 people, the system identifies the

      situation as overcrowding and generates an alert. This helps authorities prevent additional people from entering the area.

    4. Abnormal Behavior Detection

      Apart from monitoring crowd density, the system also analyzes how people move within the monitored area. This helps detect unusual behavior that may indicate panic or dangerous situations.

      How Behavior Detection Works:

      The tracking data obtained from Deep SORT provides information about:

      • Movement direction

      • Speed of individuals

      • Sudden changes in motion

        If the system detects sudden movements such as rapid rushing, pushing, or chaotic motion patterns, it considers these as abnormal crowd behaviors. For instane, during a crowded event, if several individuals suddenly start moving rapidly in different directions, it may indicate panic. The system detects this irregular movement and immediately sends an alert to security personnel so they can control the situation before it becomes dangerous.

  4. RESULT

    The proposed smart CCTV surveillance system for crowd monitoring and stampede prevention was successfully implemented and evaluated using a mobile-based camera setup. Instead of a traditional CCTV camera, the system utilizes a smartphone running the IP Webcam application, which streams live video over a local network. This approach provides a cost-effective and flexible alternative for real-time surveillance. Initially, the mobile device is configured using the IP Webcam application, which generates a streaming URL (e.g., http://192.168.1.4:8080/video). This URL acts as the input source for the monitoring system, enabling real-time video acquisition. The system continuously captures frames from this stream and processes them for crowd analysis.

    Figure 3. Mobile-based CCTV setup using IP Webcam

    application.

    The figure 3 shows the IP Webcam interface displaying the generated IP address and video streaming endpoint. This setup allows the mobile device to function as a wireless CCTV camera, making the system easily deployable in real-world environments without requiring dedicated surveillance hardware.

    Once the video stream is obtained, each frame is processed using the YOLO-based object detection model to identify individuals present in the scene. The model accurately detects people and assigns bounding boxes along with confidence scores, ensuring reliable detection performance.

    detection. Since the detected crowd size is below the maximum threshold, the system categorizes the situation as safe and displays a Scene Normal 2 people message. No alert notifications are triggered in this state, demonstrating that the system effectively avoids unnecessary warnings when conditions are normal.

    Figure 4. Real-time person detection using YOLO model.

    The monitoring interface displays detection results, including prediction status, confidence level, and the number of individuals detected. The system consistently achieves high confidence scores (above 85%), demonstrating robustness in real-time conditions.

    After detection, the system dynamically calculates the number of people present in the monitored area and compares it with a predefined threshold value. The crowd count is displayed in the format current count / maximum limit, enabling clear visualization of occupancy levels.

    Figure 6. Crowd limit exceeded warning displayed on interface.

    For example, when six individuals are detected while the maximum allowed limit is five, the system identifies this as an overcrowding condition. This real-time counting mechanism ensures accurate monitoring of crowd density.

    When the crowd size approaches or exceeds the predefined limit, the system generates visual alerts on the monitoring dashboard.

    As observed, the system displays messages such as CROWD LIMIT EXCEEDED 6 people detected, indicating that the monitored area has surpassed safe capacity. This immediate feedback helps operators take preventive action.

    To enhance responsiveness, the system integrates a notification module using Twilio API to send alerts via WhatsApp. When overcrowding is detected, an automatic message is triggered and delivered to the designated recipient.

    Figure 5. Real-time crowd counting and threshold

    comparison

    The figure illustrates the system operating under normal crowd conditions. The live video stream, obtained through the IP Webcam setup, is processed in real time using the YOLO- based detection model. The system detects two individuals in the monitored area and displays the result as 2 / 5, indicating that the number of people is well within the predefined safe limit.

    The prediction status is shown as NORMAL with a high

    confidence score of 96.0%, confirming the accuracy of

    Figure 7. WhatsApp alerts of crowd limit exceeded

    The alert message includes important details such as:

        • Number of people detected

        • Maximum allowed capacity

        • Timestamp of detection

        • Camera streaming URL

          For example, messages like Crowd limit exceeded! People detected: 6 (limit: 5) are sent in real time, along with the camera link for quick access. Multiple alerts with timestamps demonstrate continuous monitoring and reporting capability.

          The system also maintains a log of alerts generated over time, which helps in analyzing crowd patterns and identifying peak congestion periods. The repeated alerts shown in the results indicate that the system reliably detects sustained overcrowding conditions and continuously notifies authorities.

          Additionally, when the number of people falls below the threshold, the system automatically updates the status to a safe condition, indicating normal crowd levels. This dynamic classification ensures that alerts are only generated when necessary, reducing false alarms.

          Overall, the experimental results confirm that the proposed system effectively performs:

        • Real-time video streaming using mobile-based IP Webcam

        • Accurate person detection using YOLO model

        • Dynamic crowd counting and threshold comparison

        • Immediate visual alerts on monitoring dashboard

        • Automated WhatsApp notifications using Twilio API

        • Continuous alert logging with timestamps

    The integration of mobile-based CCTV, AI-based detection, and instant communication makes the system highly efficient and cost-effective for real-world applications such as public gatherings, transportation hubs, and event management. This approach significantly enhances early detection of overcrowding and helps prevent stampede situations.

    Figure 8. Anomaly detection

    Figure 9. WhatsApp alerts of Anomaly Detection

    The figure illustrates the anomaly detection capability of the proposed system using the YOLO-based object detection model. In this scenario, the system identifies multiple individuals in the scene and detects unusual behaviour, such as physical interaction or aggressive actions between people. As shown, bounding boxes are generated around each detected person (Man #1, Man #2, and Man #3), enabling the system to track their positions and movements in real time.

    The system analyses spatial proximity and interaction patterns between individuals to identify abnormal activities. In this case, the close physical engagement between two individuals is classified as a potential anomaly. Based on the detection results and behaviour analysis, the system triggers an anomaly alert with a confidence score (e.g., 72.2%), indicating the likelihood of abnormal activity.

    Once an anomaly is detected, the system immediately sends a notification through the integrated WhatsApp alert mechanism using the Twilio API. The alert message includes critical details such as anomaly status, confidence level, timestamp, number of people present in the scene, and the camera streaming link. This enables authorities to quickly access the live feed and assess the situation.

    The continuous stream of alerts shown in the figure demonstrates the systems ability to monitor behaviour in real time and respond instantly to potential threats. This feature is particularly useful in public areas where early detection of conflicts or unusual activities can help prevent escalation into dangerous situations.

    Overall, the results confirm that the proposed system not only performs crowd counting but also enhances surveillance by detecting behavioral anomalies, thereby improving safety and enabling proactive intervention.

  5. CONCLUSION

In this work, a crowd management and stampede prevention system based on computer vision techniques has been proposed to enhance safety in crowded environments. The system utilizes real-time video input from surveillance cameras to monitor crowd conditions and analyze the behavior of individuals in the monitored area. By using the YOLOv8 object detection algorithm, the system can accurately detect people present in the scene, while the Deep SORT tracking algorithm is used to track the movement of individuals across consecutive video frames. These algorithms enable the system to estimate crowd density and monitor the number of people present within a specific region. The system compares the detected crowd count with the predefined capacity of the monitored area in order to identify situations of overcrowding. In addition to density monitoring, the system also analyzes movement patterns to detect abnormal behaviors such as sudden rushing or irregular crowd movement that may indicate potential panic situations. Whenever such conditions are detected, the system generates alerts that can assist authorities in taking preventive measures to control the crowd. The proposed system demonstrates how artificial intelligence and real-time video analysis can be effectively used to support crowd monitoring and improve public safety. By providing early warnings of overcrowding and abnormal crowd behavior, the system can help reduce the risk of stampede incidents during large gatherings and assist authorities in maintaining safe crowd conditions.

REFERENCES

  1. M. Penna, et al., Stampede monitoring and pre-alarm system using computer vision techniques, International Journal of Engineering and Technology, 2018.

  2. L. Fu, et al., Early warning model of stampede based on Naïve Bayes classifier, Proceedings of the International Conference on Safety Science, 2016.

  3. P. Jalaja and K. Deeksha, Smart event management system using IoT, AI, and big data analytics for large-scale gatherings, International Journal of Smart City Applications, 2025.

  4. A. Singh and S. Tripathi, Smart crowd management framework for large-scale religious events, Journal of Emerging Technologies in Public Safety, 2025.

  5. M. Yamuna, et al., AI and machine learning-based crowd monitoring system using CCTV surveillance, International Journal of Computer Vision and Applications, 2024.

  6. A. Kanaujiya and R. Tiwari, Crowd management, security, and surveillance during mass gatherings: A case study of Kumbh Mela, Journal of Disaster Management and Safety Engineering, 2022.

  7. R. Jayaraj, et al., Secure smart surveillance system for real-time crowd behavior recognition using CNN-LSTM, International Journal of Advanced Computer Science and Applications, 2025.

  8. A. C. Cob-Parro, et al., Real-time stampede detection using optical

    flow and machine learning techniques, IEEE Access, vol. 9, 2021.

  9. S. Divya, et al., AI-based crowd stampede prevention system using YOLOv8, International Journal of Artificial Intelligence and Applications, 2024.

  10. M. Penna, et al., Real-time crowd monitoring using Haar cascade-based face detection, International Conference on Image Processing and Vision Systems, 2018.

  11. A. Verma and R. Mittal, Real-time stampede detection using deep learning and edge computing, IEEE Transactions on Intelligent Transportation Systems, 2023.

  12. M. Qaraqe, et al., PublicVision: A secure smart surveillance system for crowd behavior recognition, IEEE Access, vol. 11, 2023.

  13. Y. Jiang, et al., Ultra large-scale crowd monitoring system architecture

    and design issues, IEEE Systems Journal, 2021.

  14. Y. Lu, et al., Risk factors of human stampede in mass gatherings,

    Safety Science, 2025.

  15. S. Khare, et al., Smart crowd security surveillance using AI and machine learning, International Journal of Advanced Research in Computer Science, 2024.

  16. C.-H. Shao, et al., Stampede events and strategies for crowd management, Simulation Modelling Practice and Theory, 2019.

  17. A. M. Al-Shaery, et al., Crowd management challenges: A tackling

    approach using multi-sensor fusion, IEEE Access, 2019.

  18. A. B. Sarvaiya, et al., Anti-stampede system using image processing,

    International Journal of Computer Applications, 2018.

  19. W. M. Shalash, et al., Crowd behavior detection and management via mobile applications, Journal of Ambient Intelligence and Humanized Computing, 2019.

  20. V. Bilade, et al., Crowd surveillance using AI and deep learning,

    International Journal of Computer Science and Engineering, 2024.

  21. S. Rangdale, et al., Survey on real-time crowd detection and

    management systems, IEEE Access, 2024.

  22. B. S. Prakash, et al., AI-enhanced surveillance systems: A comprehensive survey, Journal of Artificial Intelligence Research, 2024.

  23. W. T. Al-Nami, Ranking crowd management strategies using MCDM approaches, Expert Systems with Applications, 2023.

  24. N. Al-Nabhani, et al., IoT-based approach for crowd management and

    congestion control, Future Generation Computer Systems, 2021.

  25. T. Franke, et al., Smart crowds in smart cities: Participatory crowd management platform using smartphones, IEEE Transactions on Mobile Computing, 2015.

  26. K. Shivram and R. VenkataKrishnan, Crowd monitoring system using image processing and IoT, International Journal of Engineering Research & Technology, 2021.

  27. K.-M. Ha, Crowd stampede management at sporting events: A systematic literature review, Safety Science, 2024.

  28. F. Escobedo, et al., A smart crowd monitoring and management model for intelligent environments, Sensors, 2024.

  29. C. Jadhav, et al., Smart crowd monitoring and suspicious behavior detection using deep learning, International Journal of Computer Vision Applications, 2023.

  30. K. P. Smithashree, et al., Secure Crowd AI: Crowd estimation and surveillance system, IEEE Access, 2025.

  31. H. H. Y. Saad, et al., Crowd detection, monitoring and management: A literature review, Journal of Big Data, 2023.

  32. P. Siva, et al., Smart surveillance systems using YOLOv8: A scalable approach for crowd and threat detection, IEEE Access, 2025.

  33. E. V. Om Prakash, et al., Crowd vulnerable detection system using AI,

    International Journal of Emerging Technologies, 2023.

  34. A. C. Cob-Parro, et al., A proposal on stampede detection in real environments, IEEE Access, 2021.

  35. Sharma, et al., In-depth survey to detect, monitor and manage crowd,

    International Journal of Smart Systems, 2024.

  36. Khan, et al., IoT-based crowd congestion and stampede avoidance in

    Hajj using machine learning, IEEE Internet of Things Journal, 2023.

  37. Md. M. Rahman, Smart crowd management strategies for Kumbh Mela2025, International Journal of Disaster Management, 2023.

  38. S. S. Pawar, et al., Crowd management using IoT and machine learning, International Journal of Engineering and Technology, 2022.

  39. S. S. Pawar, et al., A novel approach for crowd management using IoT and machine learning, IEEE Access, 2025.

  40. A. Lazarou, et al., Real-time detection and mapping of crowd panic

emergencies, Sensors, 2024.