Skip to content

This project implements real-time crowd detection using YOLOv8. It identifies and tracks people in a video feed, detects crowd formation based on proximity, and logs the results in a CSV file.

Notifications You must be signed in to change notification settings

Uni-Creator/Crowd-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Crowd Detection Using YOLOv8

GitHub Repo stars GitHub forks

πŸ“Œ Project Overview

This project uses YOLOv8 for real-time crowd detection in videos. It tracks individuals, groups them based on proximity, and detects crowds that meet a defined threshold.

πŸš€ Features

  • Detects individuals using YOLOv8.
  • Tracks people across frames and assigns unique IDs.
  • Identifies crowd formations based on predefined distance thresholds.
  • Saves crowd count per frame in a CSV file.

πŸ“‚ Installation

1️⃣ Clone the Repository

git clone https://github.com/yourusername/crowd-detection.git
cd crowd-detection

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Run the Crowd Detection

python crowd_detection.py

πŸ”§ Configuration

  • CROWD_THRESHOLD: Minimum number of people required to be considered a crowd.
  • DISTANCE_THRESHOLD: Maximum distance between people for them to be considered in the same group.
  • FRAME_THRESHOLD: Number of frames a person remains tracked before being removed.

πŸ“Š Output

  • Live Video Stream: Displays detected individuals and crowds.
  • CSV Output: A file crowd_detection_results.csv is generated containing:
Frame Number Crowd Count
100 5
250 7

πŸ“Œ Dependencies

  • Python 3.8+
  • OpenCV
  • YOLOv8 (Ultralytics)
  • NumPy
  • Pandas
  • SciPy

πŸ“œ License

This project is licensed under the MIT License.

✨ Acknowledgments

  • Ultralytics YOLOv8 for object detection.
  • OpenCV for image processing.
  • SciPy for spatial distance calculations.

requirements.txt

opencv-python
opencv-python-headless
torch
torchvision
numpy
pandas
scipy
ultralytics

About

This project implements real-time crowd detection using YOLOv8. It identifies and tracks people in a video feed, detects crowd formation based on proximity, and logs the results in a CSV file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages