You only look once (YOLO) is a pre-trained real-time object detection Deep Learning model and you can use this model to predict object on the new image. This model is written using the darknet neural network.

Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.

YOLO model has several advantages over classifier-based systems. It looks at the whole image at test time so its predictions are informed by the global context in the image. It also makes predictions with a single network evaluation unlike systems like R-CNN which require thousands for a single image. This makes it extremely fast, more than 1000x faster than R-CNN and 100x faster than Fast R-CNN.

It's a pre-trained object detection model. We are not going to create our own new model here.

In this tutorial, I am going to guide you, how to setup the pre-trained YOLO Real-time object detection model and how to predict object on your custom image.

The output from the YOLO model.

Step1:

First, download the Darknet library using the below command.

git clone https://github.com/pjreddie/darknet

Then setup using the below command.

cd darknet
make

Step2:

Download the weight using the below link.

wget https://pjreddie.com/media/files/yolo.weights

The weight will be downloaded in the root directory of the darknet folder.

wget https://pjreddie.com/media/files/yolo-voc.weights
wget https://pjreddie.com/media/files/tiny-yolo-voc.weights
wget https://pjreddie.com/media/files/tiny-yolo.weights

You can use other weight files too.

Step3:

Place your desired image in the data folder which is present in the darknet folder.

Step4:

Use the below command to predict object on your desired image.

Change image.jpg to your desired image name in the above command.

It will take some time to process. Once it is done, the output file will be saved as predictions.png file. Open the predictions.png file and see the output.

That's all. I hope you have done all the steps and predicted objects on your image. Enjoy Deep Learning.

Some funny output from the YOLO model. 


Above image shows some wrong prediction. It does not mean, it is not a good model. We need to give the images as input to train the model, then predict it. You will get more accurate objects.

Official YOLO link

https://pjreddie.com/darknet/yolo/

All the codes are tested using the Mac OS Sierra. I have not tested this model with other Operating System.

Summary:

In this post, you have learned, how to setup and use the Deep Learning real-time object detection model(YOLO).