Skip to content

hrjugar/yolov8-deepsort

 
 

Repository files navigation

YOLOv8 Object Detection with DeepSORT Tracking (ID + Trails)

Steps to run code

  1. Clone the repository
git clone https://github.com/hrjugar/yolov8-deepsort.git
  1. Go to the cloned folder.
cd yolov8-deepsort
  1. Install the dependencies.
pip install -e .
  1. Set the current directory.
cd ultralytics/yolo/v8/detect
  1. Download sample video test3.mp4 from this link and save it in the current folder.

  2. Run the command below.

python predict.py model=yolov8l.pt source="test3.mp4"

Command configurations

NOTE: There are a lot of other configurations made by their original authors. The ones listed here are configurations that have been verified to work by the current author.

Configuration Description Possible Values
model YOLOv8 model to use
  • yolov8n.pt
  • yolov8s.pt
  • yolov8m.pt
  • yolov8l.pt
  • yolov8x.pt
source The path of the video file to be analyzed by DeepSORT Any video file path
show Boolean flag for displaying video while DeepSORT is processing
  • True
  • False
save_dir The path of the folder where the output will be saved Any folder path
socket_port The port to be used for the web sockets that will be used to communicate with the app. Any available port number

Outputs

As of the moment, there are two outputs that are saved in the save_dir folder:

  • The original input video file that has a bounding box marked on each object on each frame
  • The results of DeepSORT in JSON, formatted in the following way:
    [
      // FRAME 1
      [
        // FRAME 1 OBJECT 1
        {
          "id": 1,
          "classification": "car",
          "x": 501,
          "y": 395,
          "w": 152,
          "h": 122
        },
        // OTHER FRAME 1 OBJECTS
        ...
      ],
      // OTHER FRAMES
      ...
    ]
    

About

YOLOv8 Object Tracking using PyTorch, OpenCV and DeepSORT

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • Shell 0.7%