In Large Crowd gatherings like religious events, concerts, festivals, stadiums, and campus crowds often attract thousands of people. Managing these dynamic environments is challenging, and delays in identifying overcrowding can lead to confusion, safety risks, or life-threatening incidents.
To address this, we developed a real-time AIoT Crowd Monitoring and Evacuation System that combines AI-based video analytics, IoT sensors, oneM2M interoperability, and 5G connectivity to monitor crowd density, predict risks, and guide people safely using LED matrix displays, dashboards, and mobile apps.
This solution ensures faster response, safer public spaces, and clear communication during emergencies, making it ideal for large events, public infrastructure, and smart city environments.
2. System OverviewThe system continuously monitors indoor or outdoor areas using 5G cameras and IoT sensors. AI at the edge identifies crowd density, unusual human activity, and environmental risks like poor air quality. These insights flow securely through the oneM2M middleware, which ensures interoperability and real-time event delivery.
A centralized backend processes events, identifies unsafe conditions, and triggers evacuation messages or redirections on displays, mobile apps, and dashboards.
3. System Architecture3.1 Edge Device (Raspberry Pi)
· Receives video streams from 5G/IP cameras
· Runs AI models (TensorFlow) for
- People detection
- Crowd density estimation
- Activity recognition (fall, loitering, running)
· Sends only essential metadata (count, density, timestamps) to oneM2M
· Reduces bandwidth by avoiding raw video transmission
3.2 oneM2M Middleware (ctOP- City IoT Operating platform)
· Acts as the unified IoT communication layer
· Standardizes data exchange between devices and backend
· Uses publish–subscribe mechanism for real-time updates
· Ensures security, scalability, and cross-device interoperability
· Ideal for large smart-city environments with multiple IoT systems
3.3 Backend Server (FastAPI)
· Receives real-time events from oneM2M
· Stores them in PostgreSQL
· Runs business logic for:
o Threshold analysis
o Hazard detection
o Predictive analytics
· Sends alerts to LED displays and dashboards
· Provides APIs for mobile and web applications
3.4 LED Matrix Display Module
· Receives instant HTTP commands from the backend
· Displays messages such as:
o “Room Full – Redirect to Room 2”
o “AQI 125 – Unsafe, Please Evacuate”
o “Crowd Density High – Proceed to Exit A”
· Ensures rapid crowd communication
3.5 Dashboard & Mobile App
· Shows live crowd density, video feed, alerts, and predictions.
· Used by administrators, security teams, and event managers
· Allows remote monitoring and decision-making
· Built using React (web) and Flutter (mobile)
Hardware
- Raspberri-Pi 5
- ESP8266/ ESP32
- LED-Matrix Display
- Piezo-Buzzer
- AHT10-(Temperature & Humidity)
- Noise-Sensor
- RTC-Module
- SMPS-Power Supply
- 5G/IP Cameras
Software & Technologies
- Python3
- FastAPI
- TensorFlow
- Scikit-learn
- Arduino C++
- oneM2M APIs (Mobius / CTOP)
- PostgreSQL
- Flutter(mobile)
- React.js(dashboard)
The AI models are optimized for edge deployment:
- Quantized models for low power consumption
- Real-time inference for tracking and density classification
- Efficient metadata extraction
- Server-side ML for predictive analytics and anomaly detection
This hybrid edge + cloud architecture ensures both high performance and reliability.
6. Crowd Monitoring on oneM2M Platform:The system fully leverages the oneM2M architecture:
Benefits
- Global IoT interoperability
- Secure data exchange
- Standardized resource structure
- Subscription-based event notifications
- Integration with smart city ecosystems
Data Structure Includes
- Timestamp
- People count
- Crowd density
- Activity detections (fall, running, loitering)
- Air quality metrics
Step 1 - Video Capture
5G cameras send video to edge devices.
Step 2 - Edge Processing
Raspberry Pi detects:
- People count
- Density level
- Human activity
- Environmental anomalies
Posts event as a oneM2M content instance.
Step 3 - oneM2M Middleware
- Stores event data
- Sends event notification to backend via HTTP POST
Step 4 - Backend Processing
- Parses notifications
- Stores data in PostgreSQL
- Checks alert thresholds
- Sends commands to LED displays
- Updates dashboards with real-time alerts
Step 5 - User Experience
Admins see:
- Live video feed
- Crowd levels
- Alerts
- Predictions
- LED displays update instantly for the public.
- HTTP
- RTSP
- oneM2M APIs for standardized IoT interoperability
- 5G and Wi-Fi for camera connectivity
Python 3: The primary programming language used for AI/ML Modelling, raspberry pi and backend server. Python's simplicity and wide support for libraries make it ideal for managing the interactions between edge device and backend server.
Arduino C++: Used to program the ESP32 for the LED Matrix Display to display the alerts
oneM2M based ctOP (City IoT Operating Platform) APIs: Used to integrate & broadcast the data into the broader multi devices and smart city infrastructure.
Flutter: Development of android app for the crowd monitoring dashboard.
React: React.js framework for the development of the frontend dashboard.
Scikit-learn: Scikit-learn library for training the Predictive Crowd monitoring model.
Tensor flow: TensorFlow for running Model in an edge device for the Crowd Monitoring to detect the people count, crowd density and detect the activity of the people.
Postgres Database: Postgres database serves as a reliable relational database for managing structured event metadata, node configurations, and historical logs.
10. AI Processing and Optimization:AI components are optimized to operate efficiently on edge hardware. Models for person detection and density estimation are quantized and accelerated to meet the performance constraints of resource-limited devices like Raspberry Pi or Jetson Nano. Only high-value metadata such as timestamps, bounding count, and density level is transmitted upstream, reducing bandwidth consumption. The backend may also host heavier ML models for anomaly detection or crowd flow prediction, leveraging more powerful compute resources. This hybrid edge–cloud AI strategy ensures speed at the edge while enabling deeper analysis in the backend.
11. Crowd monitoring on the oneM2M Platform:The crowd monitoring system is built on top of the oneM2M standard, a widely adopted open-source CSE implementation for large-scale IoT deployments. To ensure seamless device interoperability and standardized data exchange, the system leverages the City IoT Operating Platform (ctOP), which is built directly on Mobius and provides a unified framework for managing IoT nodes, subscriptions, and data flows. ctOP acts as the middleware that connects edge devices running AI-based crowd analytics with backend services, enabling structured communication via well-defined oneM2M resources. By adopting Mobius 4 and ctOP, the platform achieves strong scalability, secure message routing, and reliable real-time event delivery making it an ideal foundation for high-frequency crowd monitoring across campuses, public spaces, and smart city environments.
12. Authentication Process:Authentication within the system is designed to ensure secure access to data and functionalities. Admins log in through a token-based authentication mechanism implemented using JWT (JSON Web Tokens). When a user enters valid credentials, the backend validates them against stored records in the database and issues a signed token that encodes the user’s identity and permissions. This token must then accompany every subsequent request to protected API routes, ensuring that only authorized users can view live video feed, modify node configurations, or access sensitive analytics.
Unauthenticated Users:
Unauthenticated users will have limited access to the web dashboard and complete access to the mobile app
Authenticated Users (Admins):
Authenticated users will have access to view the live video feed of which is being processed along with the dashboard and the predictive analysis.
Data Structure and Containers on the oneM2M Platform
Figure shows the hierarchical organization of the Crowd Monitoring Application Entity (AE) within the oneM2M based Mobius resource tree.
Crowd Monitoring Container (include pics)
· Time stamp
· People count
· Crowd density
· Loitering Detection
· Fall Detection
· Running detection
13. By leveraging the oneM2M platform, this system achieves:- Standardized IoT Interoperability:
oneM2M provides a global standard for IoT device and data interoperability. Mobius 4, as a oneM2M-compliant Common Service Entity (CSE), enables seamless integration of diverse devices (edge nodes, sensors, displays) and applications (backend, dashboards) in this system. - Subscription & Notification Mechanism:
The backend subscribes to relevant containers (e.g., crowd metrics) in Mobius. When an edge device posts a new content Instance (event), Mobius 4 automatically pushes a notification to the backend subscription endpoint, enabling real-time, event-driven processing. - Security & Access Control:
Mobius supports access control policies, authentication, and secure transport, ensuring only authorized devices and apps can read/write resources or receive notifications. - Integration with Smart City Ecosystems:
By using oneM2M, this system can interoperate with other smart city solutions (traffic, lighting, emergency response) that also use the standard, future-proofing your deployment.
- Video Capture & Edge Processing
- 5G cameras continuously capture video streams in monitored areas.
- Edge devices (Raspberry Pi/Jetson) receive these streams, run AI models to detect people, calculate crowd density and classify the human activity recognition in real time.
- When a new event is detected (e.g., people count or density changes), the edge device posts it as a content Instance to the oneM2M CSE.
- oneM2M Middleware
- The CSE receives the event and stores it under the appropriate container.
- The backend server has a subscription to this container. When a new event arrives, oneM2M automatically sends a notification (m2m:sgn) to the backend’s subscription endpoint via HTTP POST.
- Backend Processing
- The FastAPI backend parses the notification, extracts event data, and saves it to the Postgres database.
- If crowds are exceeded, the backend sends an HTTP GET/POST to the room display device to show a real-time alert.
- The backend also updates alarms, notifications, and provides prediction endpoints for the dashboard.
- User Experience (Dashboard & Alerts)
- Users & Admins access a web dashboard or mobile app.
- Admins can view the live video stream.
- The dashboard fetches live and historical data from the backend, visualizes crowd levels, and displays alerts.
- When a room is full, the display device shows a message, and the dashboard highlights the alert in real time.
- Users can also request crowd predictions for future times using the ML endpoints.
This AIoT-based system is built with one clear purpose: to keep people safe. By bringing together AI, IoT, oneM2M, and 5G, it creates a smart and reliable way to monitor crowds in real time and guide them during critical moments. The system doesn’t just collect data but also it understands what’s happening, reacts instantly, and communicates clearly so people can move safely and confidently.
What makes this solution powerful is its ability to scale. Whether it’s a busy campus, a large public event, a crowded marketplace, or an entire smart city, the system adapts seamlessly. It supports faster decision-making, reduces risks, and strengthens emergency response efforts.
In simple terms, this technology helps ensure that every gathering big or small remains safe, organized, and protected.



























Comments