Skip to content

mohamedamine99/YOLOv5-object-detection

Repository files navigation

YOLOv5-object-detection

The GitHub repository features two different implementations of object detection using YOLOv5 and its variants, one based on functions and the other on classes.

This GitHub repository contains Jupyter notebooks that showcase simple object detection using YOLOv5 and its variants using the aforementioned approaches. The notebooks demonstrate how to apply these models to both images and video files, and provide step-by-step instructions for implementing the object detection algorithm. Whether you're new to deep learning or just want to learn more about YOLOv5, this repository provides a great starting point for experimenting with object detection.

Table of Contents
  1. Repo Overview
  2. Comparing different YOLOv5 variants

Repo Overview:

  • YOLOv5_simple_object_detector.ipynb : Jupyter notebook for object detection on both static image files and video files with different YOLOv5 variants using a function-base approach.
  • YOLOv5_simple_Class_Based_Object_Detector.ipynb : Jupyter notebook for object detection on both static image files and video files with different YOLOv5 variants using a class-based approach.
  • Yolov5_ObjectDetector.py : a python file that contains the definition of the Yolov5_ObjectDetector class and its documentation.
  • YOLOv5_simple_Class_Based_Object_Detector_V2.ipynb : Jupyter notebook for object detection on both static image files and video files with different YOLOv5 variants using a class-based approach that demonstrates how to import and use a python class in a colab environment.
  • img results : contains results of object detection on image files.
  • video results : contains results of object detection on video files in .avi format.
  • gifs : contains results of object detection on video files in GIF format..
  • test imgs : contains images of random scenes.
  • test vids : contains videos of random scenes.
  • coco.names : The "coco.names" file is a plain text file that contains the names of the 80 object classes in the Microsoft Common Objects in Context (COCO) dataset.

Comparing different YOLOv5 variants

There are several variants of YOLOv5, each with different features and capabilities: The backbone architecture of YOLOv5 variants is based on a convolutional neural network (CNN) called CSPDarknet. This is a modified version of the Darknet architecture used in YOLOv4. CSPDarknet consists of a series of convolutional layers with shortcut connections, which helps to improve the information flow and reduce the computational cost of the network.

In this project we use 10 variants : yolov5n, yolov5s, yolov5m, yolov5l ,yolov5x ,yolov5n6, yolov5s6, yolov5m6, yolov5l6 and yolov5x6. Each YOLOv5 variant uses a different CSPDarknet backbone, which affects the size and speed of the network. Here are the CSPDarknet backbones used by each YOLOv5 variant:

  • YOLOv5s: CSPDarknet53
  • YOLOv5m: CSPDarknet53 + SPP (Spatial Pyramid Pooling)
  • YOLOv5l: CSPDarknet53 + PAN (Path Aggregation Network)
  • YOLOv5x: CSPDarknet53 + SPP + PAN

The "6" in YOLOv5l6 (or any other yolov5 variant) refers to the number of times the CSPDarknet backbone is repeated in the network. This results in a deeper and more complex network than YOLOv5l, which has only 4 repeats of the CSPDarknet backbone.

  • YOLOv5n: This is the smallest and fastest variant of YOLOv5, making it ideal for real-time applications.
  • YOLOv5s: This is a smaller and faster version of YOLOv5, which makes it a more suitable choice for applications that require real-time processing.
  • YOLOv5m: This variant is larger and slower than YOLOv5s but provides better accuracy.
  • YOLOv5l: This variant is even larger and slower than YOLOv5m but provides even better accuracy.
  • YOLOv5x: This is the largest and slowest variant of YOLOv5, but it provides the highest accuracy.

Object detection on image files

yolov5n yolov5s yolov5m yolov5l yolov5x
yolov5n_6 yolov5s_6 yolov5m_6 yolov5l_6 yolov5x_6

Object detection on video files

yolov5n yolov5n6
yolov5m yolov5x6

About

This GitHub repository showcases simple object detection using different YOLOv5-based models on images and videos.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published