Building on top of others' work is very important to becoming a successful practitioner in deep learning. For this implementation, we will use the official YOLO-v4 implementation to identify the location of buses and trucks in images. We will clone the repository of the authors' own implementation of YOLO and customize it to our needs in the following code.
The following code is available as Training_YOLO.ipynb in the Chapter08 folder of this book's GitHub repository - https://tinyurl.com/mcvp-packt.
Installing Darknet
First, pull the darknet repository from GitHub and compile it in the environment. The model is written in a separate language called Darknet, which is different from PyTorch. We will do so using the following code:
- Pull the Git repo:
!git clone https://github.com/AlexeyAB/darknet
%cd darknet
- Reconfigure the Makefile file:
!sed -i 's/OPENCV=0/OPENCV=1/' Makefile
# In case you dont have a GPU, make sure to comment...