Multiple object detection
多目标检测
Today we will look at how we can use YOLO in OpenCV framework.YOLO first came out in 2016, which is used for multiple object detection. Its compatible with OpenCV framework but we need to download “yolov3.weights” and also “yolov3.cfg”. I have uploaded these file along with the code on my github repo.
今天,我们将探讨如何在OpenCV框架中使用YOLO.YOLO于2016年首次问世,用于多目标检测。 它与OpenCV框架兼容,但我们需要下载“ yolov3.weights”和“ yolov3.cfg”。 我已经将这些文件以及代码上传到我的github存储库中。
Lets go through the code now, its fairly simple.So the first step would be to import the model and read “coco.names” which contains the image labels and get the output layer.
现在让我们来看一下它的代码,它非常简单。因此第一步是导入模型并读取包含图像标签的“ coco.names”并获取输出层。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/1d2569a767310e51656399496291b3da.png)
Next thing would be to read the input image, and create blob to extract the features from the input image. The input dimension of the image was 416*416 and (0,0,0) signifies the color space of the image.
下一步是读取输入图像,并创建Blob以从输入图像中提取特征。 图像的输入尺寸为416 * 416,并且(0,0,0)表示图像的色彩空间。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/38ec1eaeec056ae823d1826269bdab4b.png)
We will loop through the blob and find out the objects which has been detected. But before that we have to feed blob to the yolo algorithm and extract its features from the output layer. We can relate it to a CNN model.Also we are interested in object with more than 50% confidence prediction.
我们将遍历该blob并找出已检测到的对象。 但是在此之前,我们必须将blob馈给yolo算法并从输出层提取其特征。 我们可以将其与CNN模型相关联。此外,我们对具有50%以上置信度预测的对象也很感兴趣。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/8c6fbaf7c16571aa02cb1b26f47bb44f.png)
The challenge is to separate out the redundant object which the algorithm detects. Finally we can create a bounding box and display the image.
挑战在于分离算法检测到的冗余对象。 最后,我们可以创建一个边界框并显示图像。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/59ed3f6d81c3b314d3a540f9704f804e.png)
翻译自: https://medium.com/@ishanmazumderedu/yolo-with-opencv-7f0a4e5c05cb