Skip to content

YOLOv8 Object Tracking and Counting using PyTorch, OpenCV and DeepSORT, deployed on Streamlit.

License

Notifications You must be signed in to change notification settings

monemati/YOLOv8-DeepSORT-Streamlit

Repository files navigation

YOLOv8 DeepSORT Streamlit


Ultralytics CI YOLOv8 Citation Docker Pulls
Run on Gradient Open In Colab Open In Kaggle

Introduction

This repository supply a user-friendly interactive interface for YOLOv8 with Object Tracking and Counting capability. The interface is powered by Streamlit.

Features

  • Feature1: Object detection task.
  • Feature2: Multiple detection models. yolov8n, yolov8s, yolov8m, yolov8l, yolov8x
  • Feature3: Multiple input formats. Image, Video, Webcam
  • Feature4: Multiple Object Tracking and Counting.

Run online

You can use This link to try an online version on Streamlit.

Installation

Create a virtual environment

# create
python -m venv yolov8-mot-streamlit

# activate
source yolov8-mot-streamlit/bin/activate

Clone repository

git clone https://github.com/monemati/YOLOv8-DeepSORT-Streamlit.git
cd YOLOv8-DeepSORT-Streamlit

Install packages

# Streamlit dependencies
pip install streamlit

# YOLOv8 dependecies
pip install -e '.[dev]'

Download Pre-trained YOLOv8 Detection Weights

Create a directory named weights and create a subdirectory named detection and save the downloaded YOLOv8 object detection weights inside this directory. The weight files can be downloaded from the table below.

Model size
(pixels)
mAPval
50-95
Speed
CPU ONNX
(ms)
Speed
A100 TensorRT
(ms)
params
(M)
FLOPs
(B)
YOLOv8n 640 37.3 80.4 0.99 3.2 8.7
YOLOv8s 640 44.9 128.4 1.20 11.2 28.6
YOLOv8m 640 50.2 234.7 1.83 25.9 78.9
YOLOv8l 640 52.9 375.2 2.39 43.7 165.2
YOLOv8x 640 53.9 479.1 3.53 68.2 257.8

Run

streamlit run app.py

Then will start the Streamlit server and open your web browser to the default Streamlit page automatically. For Object Counting, you can choose "Video" from "Select Source" combo box and use "test3.mp4" inside videos folder as an example.

Result

alt text

Acknowledgement