Giter Site home page Giter Site logo

vehiclecounting's Introduction

People Counting

Project Aim

The aim of this project is to develop a robust system for counting vehicles passing a road using advanced computer vision techniques. The code works on saved vids and RTSP stream. This involves using the YOLOv8 model to detect and track vehicles in video feeds. The project focuses on accurately counting the number of vehicles crossing a predefined line, making it applicable for scenarios such as traffic monitoring.

Project Overview

The primary goal of this repository is to implement a vehicle counting system using the YOLOv8 object detection model from Ultralytics. The model is trained on personal labeled data [can be locally found in D://omer//vehicle counting//data], the datasets are not extencive, hence the system is not robust. The conclusion we came to is that to deploy the model for any application we would first need to deploy the camera, collect some data, label it, finetune the model.

Table of Contents

Getting Started

Prerequisites

  • Python
  • YOLOv8 (Ultralytics)

Installation

  1. Clone the repository: git clone https://github.com/omerAJ/vehicleCounting.git cd vehickeCounting

  2. Install required Python libraries: pip install -r requirements.txt

Usage

Detection

  • detect and count on stream

    • Use the provided script in Scripts/count.py to run the YOLOv8 model on RTSP stream. This script loads the pre-trained YOLOv8 model and applies it to detect and count vehicles in the stream, it tracks the detected vehicles across frames and counts how many cross a predefined line in the video feed. Adjust the line coordinates in the script based on your specific requirements. The counts are only displayed on stream right now, but they can easily be stored in a db or csv for future reference.
  • Count and collect GT

    • In addition to detect and count this code can be used to collect GT counts to evaluate performance of model. As you watch the video, the model counts are automatically incremented and you can use key presses to count the actual vehicle classes in/out, adjust the key:value mappings based on your classes.

Training

Dataset

There are many publicly available datasets for vehicle classification, but each are very small and specialized. I have trained on multiple combinations of these and availed no luck for a robust and generalizable model. The best bet right now is to finetune on a small but good quality dataset from the site of deployment like we did with traffic cams.

Training

  • use train.py to train the model, provide it path to the data.yaml file and select the model you want to train.

Pre-trained weights

  • all pretrained models are saved in D://omer/YOLO_weights

Acknowledgements

  • This project was done at Centre for Urban Informatics, Technology, and Policy (CITY @ LUMS)

vehiclecounting's People

Contributors

omeraj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.