Skip to content

Conductor15/pedestrian-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pedestrian Tracking with YOLOv8 and DeepSORT

1. Demo

Pedestrian tracking using YOLOv8 detector and DeepSORT tracker.

Tracking Demo

Full video: demo_1s.mp4

2. Overview

This project implements a multi-object pedestrian tracking system that combines a deep learning–based object detector with an appearance-based tracking algorithm.

Pedestrians are detected using Ultralytics YOLOv8 and tracked across frames using DeepSORT. The system assigns persistent IDs to pedestrians and maintains identity consistency even when objects move across frames or experience short-term occlusion.

Such tracking systems are widely used in:

  • intelligent surveillance systems

  • crowd analysis

  • smart city monitoring

  • autonomous driving perception

  • retail analytics

3. Project Structure

    pedestrian-tracking
    │
    ├── configs/               # Configuration files
    │
    ├── data/
    │   ├── raw/               # Raw dataset
    │   └── processed/         # Processed dataset (YOLO format)
    │
    ├── deep_sort/             # DeepSORT tracking
    │
    ├── demo/                  # Demo videos and GIFs
    │
    ├── models/                # Trained detector and ReID weights
    │
    ├── notebooks/             # Experiments and analysis
    │
    ├── scripts/               # Training and inference scripts
    │   ├── prepare_dataset.py
    │   ├── train_detector.py
    │   ├── test_detector.py
    │   ├── demo_detector.py
    │   └── track_video.py
    │
    ├── src/                   # Core tracking pipeline
    │   ├── detector.py        # YOLOv8 pedestrian detector wrapper
    │   ├── tracker.py         # DeepSORT tracker interface
    │   ├── tracking_pipeline.py  # End-to-end tracking pipeline
    │   ├── preprocess_mot17.py   # MOT17 dataset preprocessing
    │   │
    │   └── utils/
    │       └── visualization.py  # Bounding box & ID visualization
    │
    ├── outputs/               # Tracking results
    ├── runs/                  # Training logs and checkpoints
    │
    ├── requirements.txt
    ├── Makefile
    └── README.md

4. Dataset

This project uses the MOT17 dataset, a widely used benchmark for multi-object pedestrian tracking.

The dataset contains video sequences with frame-level bounding box annotations for pedestrians, making it suitable for training pedestrian detectors and evaluating tracking algorithms.

Due to its large size, the dataset is not included in this repository.

5. Installation

Follow the steps below to set up the project environment.

5.1. Clone the repository

git clone https://github.com/Conductor15/pedestrian-tracking.git
cd pedestrian-tracking

5.2. Install dependencies

Install the required Python packages:

make install

After installation, the environment will contain all dependencies required for training the detector and running the tracking pipeline.

6. Data Preparation

6.1. Download

You can download the dataset from Kaggle:

https://www.kaggle.com/datasets/wenhoujinjust/mot-17

After downloading, extract the dataset and place it in data/raw/

Detailed instructions for dataset organization can be found in data/raw/notes.md

6.2. Processing

Once the dataset is placed in the correct directory, run the preprocessing pipeline:

make process_data

This step will:

  • parse the MOT17 annotations

  • convert bounding boxes to YOLO format

  • generate training and validation splits

  • store the processed dataset in data/processed/

7. Training Detector

The pedestrian detector is trained using Ultralytics YOLOv8 on the processed dataset.

Before training, ensure that the dataset has been prepared and converted to the required format.

Run the following command to start training:

make train_detector

During training, the system will:

load the processed dataset from data/processed/

train the YOLOv8 pedestrian detector

save training logs and checkpoints

Training outputs are stored in runs/

This directory contains:

  • training logs

  • model checkpoints

  • evaluation metrics

The trained detector weights will be saved in the models/ directory.

8. Tracking Pipeline

The tracking pipeline combines object detection with multi-object tracking to assign consistent IDs to pedestrians across video frames.

This project uses:

Ultralytics YOLOv8 for pedestrian detection

DeepSORT for multi-object tracking

To run the full tracking pipeline on a video:

make track_video

The pipeline performs the following steps:

  • Detect pedestrians in each frame using YOLOv8

  • Extract appearance embeddings for each detection

  • Associate detections across frames using DeepSORT

  • Assign and maintain unique tracking IDs

  • Tracking results will be saved in outputs/

9. Results

9.1. Detector Performance

The pedestrian detector was trained and evaluated using Ultralytics YOLOv8 on the MOT17 dataset.

Evaluation results on the validation set:

Metric Score Precision 0.903 Recall 0.803 mAP@0.5 0.901 mAP@0.5:0.95 0.652

The detector achieves strong performance for pedestrian detection in crowded scenes, which provides reliable inputs for the multi-object tracking pipeline.

9.2.Tracking Demo

The tracking pipeline combines the YOLOv8 detector with DeepSORT to maintain consistent pedestrian identities across frames.

  • The output video contains:

  • pedestrian bounding boxes

  • unique tracking IDs

  • consistent identity tracking across frames

Full video output: demo/demo_1s.mp4

Acknowledgements

This project builds upon several open-source works in the fields of object detection and multi-object tracking.

Ultralytics YOLOv8 for pedestrian detection

DeepSORT for multi-object tracking. Implementation reference: https://github.com/nwojke/deep_sort

We thank the authors for making their work publicly available.

License

This project is released under the MIT License.

About

Real-time pedestrian tracking using YOLOv8 for detection and DeepSORT for multi-object tracking on the MOT17 dataset.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors