Skip to content

Real-time person tracking system using YOLOv12 + SORT, with sleek movement path visualization! πŸŽ₯✨

License

Notifications You must be signed in to change notification settings

bigman1208000/person-tracker-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Person Tracker πŸ‘₯

Python 3.8+ OpenCV YOLOv8 License: MIT

alt text

A comprehensive computer vision project that combines YOLO object detection with SORT (Simple Online and Realtime Tracking) algorithm to track people in videos and visualize their movement paths with elegant trail effects.

✨ Features

  • Real-time person detection using YOLOv12 with high accuracy
  • Multi-person tracking with SORT algorithm for consistent ID assignment
  • Path visualization with customizable colors, thickness, and smooth transitions
  • Fade effect option for more visually appealing trails
  • Configurable tracking parameters for different scenarios
  • Debug mode for quick testing and development
  • Support for various video formats (mp4, avi, mov, etc.)

πŸ› οΈ Installation

# Clone the repository
git clone https://github.com/yourusername/person-tracker.git
cd person-tracker

# Install dependencies
pip install -r requirements.txt

πŸ“‹ Requirements

  • Python 3.8+
  • OpenCV 4.8+
  • Ultralytics (YOLOv12)
  • NumPy 1.24.0+
  • SciPy 1.10.0+
  • FilterPy 1.4.5 (for SORT algorithm)
  • Additional libraries listed in requirements.txt

πŸš€ Usage

Basic Usage

# Basic usage with default parameters
python Tracker.py

Using Custom Video

# Using custom video file
python Tracker.py --input your_video.mp4 --output result.mp4

Customizing Tracking Parameters

# Customize tracking visual appearance
python Tracker.py --color blue --thickness 8 --fade-effect

# Adjust SORT tracking algorithm parameters
python Tracker.py --min-hits 5 --max-age 20 --iou-threshold 0.4

Command Line Options

Option Description Default
--input Input video file path Mossad.mp4
--output Output video file path output_tracking.mp4
--debug Run in debug mode (process only 10 seconds) False
--thickness Path line thickness 5
--color Path color (red, green, blue, yellow, etc.) red
--model YOLO model to use yolo12n.pt
--min-hits Minimum hits for SORT tracker 3
--max-age Maximum age for SORT tracker (frames) 30
--iou-threshold IOU threshold for SORT tracker 0.3
--fade-effect Enable path fade effect False

πŸ” How It Works

The tracking system performs the following steps:

  1. Object Detection: Uses YOLOv12 to detect people in each video frame
  2. ID Assignment: Applies SORT algorithm to assign consistent IDs to detected people across frames
  3. Path Recording: Records the position (center point) of each person in each frame
  4. Path Smoothing: Applies interpolation for natural-looking paths
  5. Visualization: Renders the paths with customizable colors and optional fade effects

πŸ“ Project Structure

person-tracker/
β”œβ”€β”€ Tracker.py          # Main tracking script with all functionality
β”œβ”€β”€ sort/               # SORT tracking algorithm implementation
β”‚   β”œβ”€β”€ sort.py         # Core SORT algorithm
β”‚   └── data/           # Training and test data for SORT
β”œβ”€β”€ requirements.txt    # Dependencies list
β”œβ”€β”€ yolo12n.pt          # YOLOv12 nano model weights
└── README.md           # Project documentation

πŸ”§ Advanced Configuration

For advanced users who want to fine-tune the tracking system:

  • Modify the SORT parameters (--min-hits, --max-age, --iou-threshold) to balance between tracking stability and responsiveness
  • Try different YOLO models based on your performance requirements:
    • yolo12n.pt (nano): Fastest but less accurate
    • yolo12s.pt (small): Balanced performance
    • yolo12m.pt (medium): More accurate but slower
    • yolo12l.pt (large): Most accurate, requires more computing power

πŸ“ License

MIT License

πŸ™ Acknowledgments

  • SORT - Simple Online and Realtime Tracking algorithm
  • Ultralytics - YOLOv8 implementation
  • OpenCV - Open Source Computer Vision Library

πŸ“Š Performance Considerations

  • Processing speed depends on your hardware, especially GPU availability
  • For real-time tracking, consider using a smaller YOLO model or reducing input video resolution
  • Tracking accuracy can be affected by occlusion, lighting conditions, and camera movement

πŸ“§ Contact

BM - bigman1208000@gmail.com

Project Link: https://github.com/bigman1208000/person-tracker-sort

About

Real-time person tracking system using YOLOv12 + SORT, with sleek movement path visualization! πŸŽ₯✨

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages