irinagetman1973 / Vehicle-tracking-in-challenging-scenarios-using-YOLOv8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vehicle Tracking in Challenging Scenarios using YOLOv8


Run on Gradient Open In Colab Open In Kaggle

Introduction

This is a semester-long coursework for the third year of the Bachelor of Software Engineering program at Yoobee Colleges in Auckland, focusing on advanced topics in software development and project management.

This repository contains code for a vehicle tracking system based on the YOLOv8 object detection algorithm.The interface is powered by Streamlit. The system is designed to work in challenging scenarios, such as low light conditions, occlusions, and fast motion.

Features

  • Feature 1: Object detection task.
  • Feature 2: Multiple detection models. yolov8n, yolov8s, yolov8m, yolov8l, yolov8x,DriveWatch
  • Feature 3: Multiple input formats. Image, Video, Webcam
  • Feature 4: Multiple Object Tracking and Counting.

Run online

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

Installation

Create a virtual environment

# for Windows
# create 
python -m venv myvenv

# activate
myvenv\Sripts\activate

Clone repository

git clone https://github.com/irinagetman1973/Vehicle-tracking-in-challenging-scenarios-using-YOLOv8.git
cd Vehicle-tracking-in-challenging-scenarios-using-YOLOv8

Install packages

# Streamlit dependencies
pip install streamlit

# YOLOv8 dependencies
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

Custom-trained model

My custom-trained YOLOv8 model that I named DriveWatch using the following approach:
model = YOLO('yolov8n.yaml').load('yolov8n.pt') . The model was trained on a dataset specifically curated for bright lighting conditions. The resulting model is fast and lightweight. Notably, during visual evaluation within the Streamlit app, the model exhibited better performance compared to the largest model available in similar bright lighting scenarios. A dataset of bright lighting images for testing models can be downloaded here.

Tip 💡

For faster inference applied on videos and livestream using webcam, use lighter models. YOLOv8n (nano) works just fine.

Run

streamlit run app.py

Then will start the Streamlit server and open your web browser to the default Streamlit page automatically.

Results

Alt Text Alt Text

Acknowledgement

About


Languages

Language:Jupyter Notebook 98.7%Language:Python 1.3%