Skip to content

iamrukeshduwal/yolov11_real_time_object_detection_with_DeepSORT

Repository files navigation

YOLO Object Detection and Tracking

Python 3.x YOLO Object Detection DeepSORT Tracking

A real-time object detection and tracking system using YOLO 11 and Deep SORT.


📋 Table of Contents


📖 Overview

This project implements real-time object detection and tracking using YOLO and Deep SORT. The tracking algorithm ensures persistent IDs for detected objects and handles detection across video frames.


🌟 Features

  • Real-time object detection using YOLO.
  • Deep SORT object tracking with ID persistence across frames.
  • Customizable detection confidence threshold.
  • Aspect ratio maintained using padding for resized images.
  • Filter to track only objects that appear in the center of the frame.

🛠️ Dependencies

Make sure to install the following Python libraries:

pip install opencv-python torch deep_sort_realtime numpy
  • opencv-python - For handling video frames and drawing bounding boxes.
  • torch - To load and run the YOLO model.
  • deep_sort_realtime - For object tracking across frames.
  • numpy - General-purpose array operations.

💻 Installation

  1. Clone the repository:
  2. git clone https://github.com/iamrukeshduwal/yolov11_real_time_object_detection_with_DeepSORT.git
    cd yolov11_real_time_object_detection_with_DeepSORT
    
  3. Install the required Python libraries:
  4. pip install -r requirements.txt
  5. Ensure your YOLO model weights are placed in the correct directory and update the MODEL_PATH in yolo_detection_tracker.py accordingly.

🚀 Usage

Run the following command to start detecting and tracking objects in a video:

python yolo_detection_tracker.py

Modify the video path and parameters (e.g., confidence threshold) in yolo_detection_tracker.py to suit your needs.


📝 Code Explanation

yolo_detection_tracker.py

The main script that handles video input, object detection with YOLO, and tracking with Deep SORT.

detector = YoloDetector(model_path=MODEL_PATH, confidence=0.2)
tracker = Tracker()

Tracks objects, maintains their IDs, and only tracks objects in the middle of the frame.

yolo_detector.py

Contains the YoloDetector class that loads the YOLO model and performs object detection.

detections = detector.detect(frame)

tracker.py

Defines the Tracker class, which implements object tracking using the Deep SORT algorithm.

tracking_ids, boxes = tracker.track(detections, resized_frame)

⚙️ Customization

Adjusting Detection Confidence

You can change the detection confidence threshold in the YoloDetector by modifying the following line in yolo_detection_tracker.py:

detector = YoloDetector(model_path=MODEL_PATH, confidence=0.3)

Filtering Objects by Position

The current implementation only tracks objects detected in the middle of the frame. You can adjust this behavior in yolo_detection_tracker.py by modifying the center filtering logic.


📜 License

This project is licensed under the MIT License. See the LICENSE file for more details.


Developed by Rukesh Duwal with 💖

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages