Getting started with YOLOv5 in a few minutes!

Mathias Gudiksen
6 min readSep 12, 2021

Hello there, today I’ll show you how to get started with one of the best object detection algorithms at the time of writing, namely YOLO.

In this post, we will be using YOLOv5 implemented by Ultralytics. Ultralytics has made a super nice and smooth implementation, which makes it incredibly easy for us to use and get started with object detection. The network is implemented in PyTorch, but you do not need to be an expert in PyTorch to use the implementation. This is especially nice if you are not very familiar with PyTorch.

Preparing the repository

First, we have to clone the repository from GitHub into a project. I personally like to do it in a virtual environment, but do as you feel like.

When the project is created (virtual or not), open a terminal and run the following commands:

git clone https://github.com/ultralytics/yolov5

When the repository is cloned, install the requirements.

cd yolov5
pip install -r requirements.txt

Now the repository is cloned and requirements are installed we are ready to train and do inference. But before we move on, we need to take a decision on the size of the network.

Model sizes

YOLOv5 comes in 4 sizes (s, m, l and xl). Intuitively, the larger the network, the more tunable parameters, the better performance. But again, more parameters means longer…

--

--