AI-powered crowd monitoring using YOLOv8 + Streamlit. Works with webcams, CCTV/RTSP streams, video files, and demo mode.
| Feature | Description |
|---|---|
| 🎯 YOLOv8 Detection | State-of-the-art real-time person detection |
| 📡 Multi-Source Input | Webcam, RTSP/IP camera, video file, demo mode |
| 🗺️ Zone Management | Up to 6 configurable spatial zones |
| 🚨 3-Tier Alerts | Info → Warning → Critical threshold system |
| 💡 AI Suggestions | Intelligent crowd redistribution recommendations |
| 📊 Live Analytics | Real-time count history, FPS, density charts |
| 🌙 Dark UI | Industrial dark theme with neon accents |
# 1. Clone or extract this folder
cd crowd_monitor
# 2. Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux / macOS
venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run
streamlit run app.pyThe YOLOv8 model (yolov8n.pt, ~6 MB) downloads automatically on first run.
- Built-in laptop camera → index
0 - USB camera → try index
1,2, etc.
rtsp://username:password@192.168.1.100:554/stream
rtsp://admin:12345@192.168.1.100:554/Streaming/Channels/101
rtsp://192.168.1.100/live.sdp
- Upload
.mp4,.avi,.mov,.mkvvia the sidebar
- Fully simulated crowd scene — no camera needed
| Parameter | Default | Description |
|---|---|---|
| Confidence | 0.45 | YOLO detection confidence (0.1–0.9) |
| Zone Capacity | 50 | Max people per zone |
| Warning Threshold | 70% | % of capacity to trigger warning |
| Critical Threshold | 90% | % of capacity to trigger critical alert |
| Num Zones | 3 | Number of monitoring zones (1–6) |
The camera frame is divided into N equal horizontal strips.
Each detected person's bounding box center X-position determines their zone.
Frame Width
├── Zone A (0 – 33%)
├── Zone B (33 – 66%)
└── Zone C (66 – 100%)
| Level | Trigger | Action |
|---|---|---|
| ✅ Info | < 70% capacity | Normal monitoring |
| 70–90% capacity | Prepare for redirection | |
| 🚨 Critical | > 90% capacity | Immediate action required |
crowd_monitor/
├── app.py ← Main Streamlit application
├── requirements.txt
├── .streamlit/
│ └── config.toml ← Dark theme config
└── utils/
├── detector.py ← YOLOv8 people detector
├── alert_engine.py ← Alert + suggestion logic
├── zone_manager.py ← Spatial zone distribution
└── analytics.py ← Time-series tracking
For high-resolution or multi-camera setups, GPU is recommended:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118YOLO automatically uses CUDA if available.
Launch the app and switch to Demo Mode to see the system in action without a camera.
MIT — free for commercial and personal use.
CrowdSense AI is developed collaboratively by Abhishek Gaurav, Aryan Kumar and Ishan Gupta as part of our DTL project, combining our contributions to the design, development, and implementation to the project.