Running the darknet

The generic command to run the darknet is, (assuming you are currently in the darknet directory)

./darknet detector demo/test .data .cfg  .weights input

1. ./darknet – This is the shell command for execution of an executable file. If a windows machine is being used, the command will be darknet.exe followed by the arguments.

2. detector demo or detector test – detector demo is for camera feed and detector test for images.

3. The next argument is the path to the .data file

4. Followed by the path to the .cfg , configuration file 

5. The .weights file

6. And lastly the input, which can be an , image, video or camera feed. In case of images and videos, it should be a path. For camera input, it is ‘-c’ followed by the number of the camera. ‘0’ is the default camera of the system. 

All of the Above files need to be generated before we can run detection for our input. The data, and configuration files contain text and can be edited. However, in order to generate the weights file, the YOLO algorithm needs to be trained. We need additional files for the same. 

What data is needed to train YOLO?

To Run YOLO we need to create the following files

1. A data file

A data file consists of 5 lines. The number of classes to be detected, the full directory path to the training file, the full directory path to the testing file, full directory path to the names file and a backup folder to store the generated weights. It’s file extension needs to be .data

labelled data2

2. A names file

A names file contains the names of all the objects that we are training/detecting each on a new line. It has a file extension of .names

3. A training configuration file

The training configuration file is a modified yolov3 default file, for our custom dataset. Many parameters need to be changed based on our data. More about the training file is discussed in the preparation of data section. The training configuration file contains the settings to run the neural network when the model is being trained. 

4. A testing configuration file 

The testing is also a modified configuration from the yolov3 default configuration file, for our custom dataset. Many parameters need to be changed based on our data. More about the testing file is discussed in the preparation of data section. The testing configuration file contains the settings to run the neural network when the model is executing on input. 

5. A folder containing all the images and the labels in YOLO format 

This folder needs to contain all the images for training the YOLO and text files with labels. The label text files need to have exactly the same name as the image. More is discussed in the annotations section. 

Step By Step Process