Skip to content

R-Saad007/Footfall-Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 

Repository files navigation

Footfall Counter

A computer vision solution for real-time pedestrian counting using advanced object detection and tracking algorithms. This system accurately monitors foot traffic by detecting people entering and exiting designated areas in video streams.

Project Overview

The Footfall Counter leverages state-of-the-art object detection (YOLOv5) and multi-object tracking (ByteTrack) to provide accurate pedestrian counting capabilities. The system maintains individual track IDs for each person, enabling sophisticated analytics including re-entry detection and directional flow analysis.

Key Features

  • Real-time Processing: Processes video streams in real-time for immediate footfall analytics
  • Accurate Tracking: Maintains unique track IDs for each individual to prevent double counting
  • Bidirectional Counting: Distinguishes between people entering and exiting designated areas
  • Re-entry Detection: Identifies when the same individual re-enters the monitored zone
  • Configurable Zones: Customizable detection areas (highlighted in green) for flexible deployment
  • Robust Performance: Handles occlusions, varying lighting conditions, and crowded scenarios

Tech Stack

  • Python 3.x - Core programming language
  • YOLOv5 - Object detection framework for person detection
  • ByteTrack - Multi-object tracking algorithm for maintaining object identities
  • OpenCV - Computer vision library for video processing
  • NumPy - Numerical computing for efficient array operations

Getting Started

Prerequisites

Ensure you have Python 3.x installed on your system along with pip package manager.

Installation

  1. Clone the repository

    git clone https://github.com/R-Saad007/Footfall-Counter.git
    cd Footfall-Counter
  2. Set up ByteTrack

    git clone https://github.com/ifzhang/ByteTrack.git
    cd ByteTrack
    pip install -r requirements.txt
    python3 setup.py develop
    pip install cython_bbox
    cd ..
  3. Set up YOLOv5

    git clone https://github.com/ultralytics/yolov5.git
    cd yolov5
    pip install -r requirements.txt
    cd ..
  4. Install additional dependencies

    pip install -r requirements.txt

Usage

Basic Usage

Run the footfall counter on your video file:

python handler.py -vid_path path/to/your/video.mp4

Command Line Arguments

  • -vid_path: Path to the input video file (required)

Expected Output

The system will display the processed video with:

  • Bounding boxes around detected persons
  • Unique track IDs for each individual
  • Real-time counters for people entering and exiting
  • Visual indication of the counting zone (green area)

Sample Results

Note: Add screenshots of your application in action showing the detection boxes, track IDs, and counting interface

System Architecture

The footfall counting system operates through a sophisticated pipeline:

Detection Phase: YOLOv5 identifies all persons in each video frame with high accuracy, providing bounding box coordinates and confidence scores.

Tracking Phase: ByteTrack associates detections across frames, maintaining consistent track IDs even through occlusions and temporary disappearances.

Counting Logic: The system maintains two key dictionaries to track object states:

  • Entry/exit status monitoring for each tracked individual
  • Historical data to handle re-entries and prevent duplicate counting

Zone Analysis: Objects crossing the designated green counting zone trigger increment operations based on their movement direction and previous state.

Technical Implementation

Core Algorithm

The counting mechanism uses a state-based approach where each tracked object maintains:

  • Current position relative to the counting zone
  • Entry/exit history
  • Movement trajectory for directional analysis

Performance Optimizations

  • Efficient memory management through dictionary-based state tracking
  • Optimized video processing pipeline for real-time performance
  • Smart re-identification logic to handle temporary occlusions

Use Cases

  • Retail Analytics: Monitor customer flow in stores and shopping centers
  • Event Management: Track attendance and crowd density at venues
  • Security Applications: Enhance surveillance systems with automated counting
  • Urban Planning: Analyze pedestrian traffic patterns in public spaces
  • Building Management: Monitor occupancy levels in commercial buildings

Future Enhancements

  • Integration with cloud analytics platforms
  • Support for multiple counting zones in a single video
  • Heat map generation for traffic pattern visualization
  • API endpoints for real-time data access
  • Mobile app integration for remote monitoring

Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests to help improve this project.

License

This project is open source. Please check the repository for specific license terms.

Acknowledgments

  • ByteTrack Team for the robust multi-object tracking framework
  • Ultralytics for the YOLOv5 object detection model
  • OpenCV Community for comprehensive computer vision tools

This project demonstrates practical application of modern computer vision techniques for real-world analytics challenges.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages