Source: Deep Learning on Medium
Real Time Object Detection using YOLOv3 with OpenCV and Python
In the previous article we have seen object detection using YOLOv3 algorithm on image. In this article, lets go further and see how we can use YOLOv3 for real time object detection.
We can solve this problem in two ways. One is using CPU and other using GPU.
CPU has advantage that we need not install any additional resources, installations. We can right away use OpenCV for this. But the disadvantage is that it is extremely slow (it depends what configuration CPU you are running but yeah it is slow). Recommended for beginners.
GPU on the other hand has advantage of having video graphic processor, hence faster speed. But the downside is that we need to compile many libraries manually and configure many things before to start utilising for our problem definition.
Lets keep this tutorial to use CPU for real time object detection. In the last tutorial we worked with single image, while now we will be using series of images (i.e. video) in OpenCV as input.
We will recap the code before loading image. We import cv2, numpy libraries. Then we load darknet architecture in net and in classes we store all the different object from coco.names file. And get the last layer from net so as to identify object in final layer.