Code Monkey home page Code Monkey logo

mohamedamine99 / object-tracking-and-counting-using-yolov8 Goto Github PK

View Code? Open in Web Editor NEW
40.0 3.0 12.0 489.15 MB

This repository contains the code for an object detection, tracking and counting project using the YOLOv8 object detection algorithm and the SORT (Simple Online and Realtime Tracking) algorithm for object tracking. The project has been implemented using object-oriented programming principles in Python.

Jupyter Notebook 90.33% Python 9.67%
deep-learning google-colab-notebook object-counting object-detection object-tracking oop python sort yolov8

object-tracking-and-counting-using-yolov8's Introduction

Object-tracking-and-counting-using-YOLOV8

This repository contains the code for object detection, tracking, and counting using the YOLOv8 algorithm by ultralytics for object detection and the SORT (Simple Online and Realtime Tracking) algorithm for object tracking. The project provides code for both procedural and object-oriented programming implementations in Python.

The OOP implementation is designed to be easily maintainable and customizable so that it can be further used for custom object detection, tracking, and counting.

For more details check the ultralytics YOLOv8 Github repository and the YOLOv8 python documentation.

Features:

  • Object detection: The YOLOv8 algorithm has been used to detect objects in images and videos. The algorithm is known for its fast and accurate performance.
  • Object tracking: The SORT algorithm has been used for tracking the detected objects in real-time. SORT is a simple algorithm that performs well in real-time tracking scenarios.
  • Object counting: The project also includes a module for counting the number of objects detected in a given image or video.
  • OOP approach: The project has been implemented using object-oriented programming principles, making it modular and easy to understand.

Navigating this repository

Code files

  • YOLOv8_Object_Detection_procedural.ipynb : The notebook provides code for object detection using YOLOv8, including different variants with different architectures and trade-offs between speed and accuracy. The code follows a procedural approach rather than object-oriented programming to make it simpler and easier to understand for beginners.

  • YOLOv8_Object_Detection_OOP.ipynb : This notebook provides code for object detection using YOLOv8, including different variants with different architectures and trade-offs between speed and accuracy. The code follows an object-oriented approach rather than procedural programming to make it easier to understand, modify and maintain.

  • YOLOv8_Object_Counter_OOP.ipynb : This notebook provides code for object detection, tracking and counting also using different YOLOv8 variants and an object-oriented approach.

  • YOLOv8_Object_Counter_OOP_v2.ipynb :This notebook provides code for object detection, tracking and counting also using different YOLOv8 variants and an object-oriented approach but the difference from YOLOv8_Object_Counter_OOP.ipynb is that the classes are imported as an external script named yolo_detect_and_count.py in order to avoid defining the classes inside the notebook and make it less cluttered with lines of code.

  • yolo_detect_and_count.py : a python script that contains well-documented definitions for the YOLOv8_ObjectDetector and YOLOv8_ObjectCounter classes used respectively for detecting and counting objects.

  • sort.py : a python module for object tracking using the SORT algorithm (SORT : Simple Online and Realtime Tracking)

    • This script is a slightly modified version from the original sort module by abewley , with some imports removed in order to fix some compatibility issues regarding pytorch and matplotlib backends.

Results directories

  • results - Object Counting : This directory contains the video results for object counting in the following format : [yolo variant]--[original video name].avi

  • GIFs : contains results for object detection and object counting on videos in GIF format.

  • results - custom display : This directory contains both video and image results for object detection using the custom display. The reason for this custom display is that it provides a simple alternative to the YOLOv8 native display which can sometimes be cumbersome.

  • results - default display : This directory contains both video and image results for object detection using YOLOv8 default display.

  • test vids : a directory that contains all testing videos.

  • test imgs : a directory that contains all testing images.

Other files

  • requirements.txt : Contains the modules required by the sort module
  • coco.names : Contains the labels of the 80 default classes for the COCO dataset.

object-tracking-and-counting-using-yolov8's People

Contributors

mohamedamine99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

object-tracking-and-counting-using-yolov8's Issues

Question. Class counter

Hey, good repository really! I need to implement a system to count each class separetly and save the results maybe to a csv. Do you have any idea how to do that?

An example would be; 7 cars, 2 trucks

problem using pre-trained model on object-tracking

We are running object tracking with volov8-seg.pt which works fine. But when loading a pre-trained model (best.pt) the system tries to access: No module named 'ultralytics.nn.modules.conv.” The source for this module is on GitHub but not in the ultralytics tree, so pip install ultralytics.nn.modules.conv doesn’t work. Any idea on how to deal with this would be appreciated

tried pip install 'ultralytics.nn.modules.conv. Result: ERROR: Could not find a version that satisfies the requirement ultralytics.nn.modules.conv (from versions: none) ERROR: No matching distribution found for ultralytics.nn.modules.conv

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.