Object Detection Using YOLOv5 and OpenCV DNN in C++ & Python
Object Detection Using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-
content/uploads/2022/04/yolov5-feature-image.gif)
You can either love YOLOv5 or despise it. You can’t ignore YOLOv5!
YOLO has come a long way since its first release. There are eight major versions in the YOLO family lineup – The official ones by Joseph
Redmon – YOLOv1 to YOLOv3, and others – YOLOv4, YOLOv5, PP-YOLO, YOLOR, and YOLOX. YOLOv5 has gained quite a lot of traction,
controversy, and appraisals since its first release in 2020. Recently, YOLOv5 extended support to the OpenCV DNN framework, which added the
advantage of using this state-of-the-art object detection model with the OpenCV DNN Module.
Learning Objectives:
Table of Contents
2. Why YOLOv5?
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
3. A brief overview of YOLOv5
Accept
4. Inference with YOLOv5
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 1/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
6. Results
If you use OpenCV DNN, you may be able to swap out your old model for the latest one with very few changes to your production code.
Secondly, if you want to deploy a Deep Learning model in C++, it becomes a hassle, but it’s very easy to deploy in C++ using OpenCV. Finally,
OpenCV CPU implementation is highly optimized for Intel processors so that might be another reason to consider OpenCV DNN for inference.
(https://opencv.org/courses)
I’ve partnered exclusively with OpenCV.org (http://opencv.org/) to bring you official courses in AI,
Computer Vision, and Deep Learning to take you on a structured path from first steps to mastery.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
Learn More
(https://learnopencv.com/privacy-policy/)
(https://opencv.org/courses)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 2/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
Although they are based on YOLOv3, all are independent development. You can also check out our previous article on YOLOv3
(https://learnopencv.com/deep-learning-based-object-detection-using-yolov3-with-opencv-python-c/). The architecture of a Fully Connected
Neural Network comprises of,
Backbone: The model backbone primarily extracts the essential features of an image.
Head: The head contains the output layers that have final detections.
Neck: The neck connects the backbone and the head. It mostly creates feature pyramids. The role of the neck is to collect feature maps
of different stages.
(https://learnopencv.com/wp-content/uploads/2022/04/one-stage-detector-architecture.jpg)
As of now (12th April 2022), two years since the initial release, YOLOv5 still does not have a paper published. Therefore, we don’t have detailed
information of the architecture yet. The info provided in the blog post is from the GitHub readme, issues, releases note and .yaml configuration
files. However, it is in a very active development state and we can expect further improvements with time. The following table summarizes
architecture of v3, v4 and v5.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 3/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-
content/uploads/2022/04/model-architecture-yolo-summary.jpg)
YOLOv4 is the official successor of YOLOv3 as it has been forked from the main repository (https://github.com/pjreddie/darknet.git). Written in
C++, the framework is Darknet. YOLOv5, on the other hand, is different from previous releases. It is based on Pytorch
(https://pytorch.org/)framework.
Initially, YOLOv5 did not have substantial improvements over YOLOv4. However, with recent releases, it has proved to be better in a lot of areas.
A recent paper on YOLO (July 2021), YOLOX: Exceeding YOLO Series in 2021 (https://arxiv.org/pdf/2107.08430.pdf), reports the superiority of
YOLOv5 over YOLOv4 in terms of speed and accuracy. However, according to the report, not all YOLOv5 models could beat YOLOv4. We will
release a detailed comparison of different YOLO versions in a future post.
(https://learnopencv.com/wp-content/uploads/2022/04/peformance-comparison-chart-yolox-1.jpg)
Table: Comparison of the speed and accuracy of different object detectors on COCO 2017 test-dev. Source
(https://arxiv.org/pdf/2107.08430.pdf).
YOLOv5 was released with four models at first. Small, Medium, Large, and Extra large. Recently, YOLOv5 Nano and support for OpenCV DNN
were introduced. Currently, each model has two versions, P5 and P6.
P5: Three output layers, P3, P4, and P5. Trained on 640×640 images.
P6: Four
We output layers,
use cookies P3,that
to ensure P4,weP5,
giveand P6.
you the Trained
best onon1280×1280
experience images.
our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
P5 Models P6 Models
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 4/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
YOLOv5n YOLOv5n6
YOLOv5s YOLOv5s6
YOLOv5m YOLOv5m6
YOLOv5l YOLOv5l6
YOLOv5x YOLOv5x6
So it has a total of 10 compound-scaled object detection models. We will see more about their performance later but first, let us see how to
perform inference using them.
detect.py
PyTorchHub
The basic guideline is already provided in the GitHub readme. Here, we will walk through a little more detail on what else can be done. Let us
go ahead and clone the GitHub repository using the command below.
1. Webcam
Can be accessed using 0, 1, 2, and so on; depending on the number of connected webcams.
2. Image
Although the official readme says .jpg, you can use many more image formats. We have tested most of them and it works fine. Currently jpeg,
png, tif, tiff, dng, webp and mpo are supported.
3. Video
Similarly for videos too, it’s not only .mp4 but also mov, avi, mpg, mpeg, m4v, wmv and mkv.
4. Path We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
We can also provide the path of a directory containing different images and videos. It will process all the supported files one by one. If
Accept
required you can also specify the type of file i e path/* mp4
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 5/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
required, you can also specify the type of file, i.e., path/*.mp4.
5. YouTube link
A super useful feature to process YouTube videos directly. However, to make it work, we need youtube-dl and pafy to be installed. You can
install them using the following command.
YouTube live stream works well given that youtube-dl and pafy are installed. But we could not make RTSP stream work using this sample
bunny video (rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4) stream. Neither did Facebook live streams. The
source code seems to be supporting YouTube live links as of now.
YOLOv5 inference with default settings generates a log that looks something like the following. Let us go through some of the inference
attributes.
1. Weights
The default weight file is yolov5s.pt, which is the small PyTorch model. We can change the weights by using the --weights flag followed by
the model name. At first, the program looks for the model in the root directory and downloads it if not available. Note that we can use any
format from the list of 11 supported platforms.
2. Input size
A factor that hugely impacts the speed and accuracy of a model. The flag is --imgsz x y , where x and y are blob input size.
3. Confidence threshold
By default the confidence threshold is 0.25. Use the flag --conf_thresh to change the threshold.
4. IOU threshold
IOU stands for Intersection Over Union. This threshold is for performing Non-maximum suppression. Try playing with the default value 0.45 to
see how it impacts the results. Flag --iou_thresh.
5. DNN
Using the flag –dnn lets the program use OpenCV DNN for ONNX inference.
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 6/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
import cv2
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
# Image
img = cv2.imread(PATH_TO_IMAGE)
# Inference
results = model(imgs, size=640) # includes NMS
# Results
results.print()
results.save()
Although both detect.py and PyTorchHub methods are decent, they have limited functionalities. We could edit the source code but a better
way is to write it from scratch. That way, we get better control over the code, with the advantage of coding in C++. Let us see how to
implement YOLOv5 using OpenCV DNN.
Download Code
To easily follow along this tutorial, please download code by clicking on the button below. It's FREE!
Download Code
NOTE: Nano, small, and medium ONNX models are included with the code folder.
It is possible to perform the conversion locally, but we recommend using colab, so that you don’t get stuck in resolving dependencies and
downloading huge chunks of data. The following commands are for converting the YOLOv5s model. The notebook contains the code to
convert and download rest of the models.
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 7/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-
content/uploads/2022/04/yolov5-opencv-dnn.png)
Import Libraries
C++
#include <opencv2/opencv.hpp>
#include <fstream>
// Namespaces.
using namespace cv;
using namespace std;
using namespace cv::dnn;
Python
import cv2
import numpy as np
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 8/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
We will discuss more about these parameters while going through the code.
Note: Unlike C++ the input size values in Python can not be of float type.
C++
// Constants.
const float INPUT_WIDTH = 640.0;
const float INPUT_HEIGHT = 640.0;
const float SCORE_THRESHOLD = 0.5;
const float NMS_THRESHOLD = 0.45;
const float CONFIDENCE_THRESHOLD = 0.45;
// Text parameters.
const float FONT_SCALE = 0.7;
const int FONT_FACE = FONT_HERSHEY_SIMPLEX;
const int THICKNESS = 1;
// Colors.
Scalar BLACK = Scalar(0,0,0);
Scalar BLUE = Scalar(255, 178, 50);
Scalar YELLOW = Scalar(0, 255, 255);
Scalar RED = Scalar(0,0,255);
Python
# Constants.
INPUT_WIDTH = 640
INPUT_HEIGHT = 640
SCORE_THRESHOLD = 0.5
NMS_THRESHOLD = 0.45
CONFIDENCE_THRESHOLD = 0.45
# Text parameters.
FONT_FACE = cv2.FONT_HERSHEY_SIMPLEX
FONT_SCALE = 0.7
THICKNESS = 1
# Colors.
BLACK = (0,0,0)
BLUE = (255,178,50)
YELLOW = (0,255,255)
Draw Label
The function draw_label annotates the class names anchored to the top left corner of the bounding box. The code is fairly simple. We pass the
text string as a label in the argument which is passed to the OpenCV function getTextSize(). It returns the size of the bounding box that the
text string would take up. These dimension values are used to draw a black background rectangle on which label is rendered by putText()
function.
C++
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=o… 9/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
Python
PRE-PROCESSING
The function pre–process takes the image and the network as arguments. At first, the image is converted to a blob. Then it is set as input to
the network. The function getUnconnectedOutLayerNames() provides the names of the output layers. It has features of all the layers, through
which the image is forward propagated to acquire the detections. After processing, it returns the detection results.
C++
Python
POST-PROCESSING
In the previous function pre_process, we get the detection results as an object. It needs to be unwrapped for further processing. Before
discussing the code any further, let us see the shape of this object and what it contains.
The returned object is a 2-D array. The output depends on size of the input. For example, with the default input size 640, we get a 2D-array of
size 25200×85 (rows x columns). The rows represent the number of detections. So each time the network run, it predicts a whopping 25200
bounding boxes. Every bounding box has a 1-D array of 85 entries that tells the quality of the detection. With this information, we can filter out
the desired detections.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/) (https://learnopencv.com/wp-
content/uploads/2022/04/detections.jpg) Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 10/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
The first two places are normalized center coordinates of the detected bounding box. Then comes the normalized width and height. Index 4
has the confidence score that tells the probability of the detection being an object. The following 80 entries tell class scores of 80 objects of
the COCO dataset 2017, on which the model has been trained.
Fun Fact: The COCO dataset 2017 has a total of 91 objects. However, 11 objects are still missing labels.
The network generates output coordinates based on the input size of the blob, i.e. 640. Therefore, the coordinates should be multiplied by the
resizing factors to get the actual output. Following steps are involved in unwrapping the detections.
C++
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 11/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
}
// Jump to the next row.
data += 85;
}
Python
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 12/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-content/uploads/2022/04/without-non-maximum-suppression.jpg)
This is solved by performing Non-Maximum Suppression. The function NMSBoxes() takes a list of boxes, calculates IOU(Intersection Over
Union), and decides to keep the boxes depending on the NMS_THRESHOLD. Curious about how it works? Check out our previous article on
NMS (http://text=Non%20Maximum%20Suppression%20(NMS)%20is,arrive%20at%20the%20desired%20results.) to know more.
C++
Python
# Perform non maximum suppression to eliminate redundant, overlapping boxes with lower confidences.
indices = cv2.dnn.NMSBoxes(boxes, confidences, CONFIDENCE_THRESHOLD, NMS_THRESHOLD)
for i in indices:
box = boxes[i]
left = box[0]
top = box[1]
width = box[2]
height = box[3]
# Draw bounding box.
cv2.rectangle(input_image, (left, top), (left + width, top + height), BLUE, 3*THICKNESS)
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 13/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
Main Function
Finally, we load the model. Perform pre-processing and post-processing followed by displaying efficiency information.
C++
int main()
{
// Load class list.
vector<string> class_list;
ifstream ifs("coco.names");
string line;
while (getline(ifs, line))
{
class_list.push_back(line);
}
// Load image.
Mat frame;
frame = imread("traffic.jpg");
// Load model.
Net net;
net = readNet("YOLOv5s.onnx");
vector<Mat> detections; // Process the image.
detections = pre_process(frame, net);
Mat img = post_process(frame.clone(), detections, class_list);
// Put efficiency information.
// The function getPerfProfile returns the overall time for inference(t) and the timings for each of the layers(in
layersTimes).
vector<double> layersTimes;
double freq = getTickFrequency() / 1000;
double t = net.getPerfProfile(layersTimes) / freq;
string label = format("Inference time : %.2f ms", t);
putText(img, label, Point(20, 40), FONT_FACE, FONT_SCALE, RED);
imshow("Output", img);
waitKey(0);
return 0;
}
Python
if __name__ == '__main__':
# Load class names.
classesFile = "coco.names"
classes = None
with open(classesFile, 'rt') as f:
classes = f.read().rstrip('\n').split('\n')
# Load image.
frame = cv2.imread(‘traffic.jpg)
# Give the weight files to the model and load the network using them.
modelWeights = "YOLOv5s.onnx"
net = cv2.dnn.readNet(modelWeights)
# Process image.
detections = pre_process(frame, net)
img = post_process(frame.copy(), detections)
"""
Put efficiency information. The function getPerfProfile returns the overall time for inference(t)
and the timings for each of the layers(in layersTimes).
"""
t, _ = net.getPerfProfile()
label = 'Inference time: %.2f ms' % (t * 1000.0 / cv2.getTickFrequency())
print(label)
cv2.putText(img, label, (20, 40), FONT_FACE, FONT_SCALE, (0, 0, 255), THICKNESS, cv2.LINE_AA)
cv2.imshow('Output', img)
cv2.waitKey(0)
5. RESULTS
The following two results have been obtained using the nano, mediumAccept
and the extra-large model. In terms of accuracy, the extra-large model
dominates It can even detect objects that our eyes can miss On the other hand nano is about 10x faster but less accurate
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 14/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
dominates. It can even detect objects that our eyes can miss. On the other hand, nano is about 10x faster but less accurate.
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5n-result-1.jpg)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 15/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5m-result.jpg)
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5x-result.jpg)
Note: To runWeinference
use cookieswith different
to ensure input
that we give yousize, models
the best must
experience bewebsite.
on our exported accordingly.
If you continue For
to use this siteexample, to set
we will assume 480areashappy
that you input
withsize; export
it. Privacy policythe model
(https://learnopencv.com/privacy-policy/)
using the following command. This is done to optimize ONNX models as they are meant for deploying.
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 16/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
However, we don’t have to convert all the models for performing tests. Use the flag —dynamic while exporting to obtain the dynamic model. No
need to mention specific input size. Then we can inference in ONNX runtime using detect.py as shown below. Where size is a multiple of 32.
(https://learnopencv.com/wp-content/uploads/2022/04/input-size-speed-test-1.jpg)
We can see great improvement in speed but at the cost of accuracy. Following are the results obtained on varying input size to YOLOv5
medium.
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5m-inference-input-size-640.jpg)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 17/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5m-inference-input-size-480-1.jpg)
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5m-inference-input-size-320.jpg)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 18/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(https://learnopencv.com/wp-content/uploads/2022/04/yolov5m-inference-input-size-160-1.jpg)
(https://learnopencv.com/wp-
content/uploads/2022/04/opencv_dnn_yolov5_inf_p5_vs_p6.jpg)
CONCLUSION We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
In this post we discussed inference using detect.py in detail, and using YOLOv5 model in OpenCV with C++ and Python. You also learned how
P T h d l ONNX f Th ill b H i YOLO 5 d l Ih j d di h
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 19/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
to convert a PyTorch model to ONNX format. The next post will be on How to train a custom YOLOv5 model. I hope you enjoyed reading the
article. Have any questions or suggestions? Add your comments below. We would come up with another post that does a detailed comparison
of YOLOv5 with other YOLO versions in terms of speed and accuracy.
Subscribe Now
All views expressed on this site are my own and do not represent the opinions Installation
of OpenCV.org or any entity whatsoever with which I have been, am now, or will
PyTorch
be affiliated.
Getting Started with OpenCV
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 20/21
22/04/2022 18:31 Object Detection using YOLOv5 and OpenCV DNN in C++ & Python
(htt
ps:/
/w
ww
.fa
ceb
ook
.co (htt (htt (htt
m/ ps:/ ps:/ ps:/
Lea /w /w /w
rno ww ww ww
pen .ins .lin .yo
cv- tag ked (htt utu
27 ra in.c ps:/ be.
72 m.c om /tw co
84 om /in/ itte m/
88 /le sat r.co c/L
93 arn ya m/ ear
89 ope mal AiO nO
05 ncv lick pen pen
9)
/)
/)
cv)
CV)
Course Information
About LearnOpenCV
In 2007, right after finishing my Ph.D., I co-founded TAAZ Inc. with my advisor Dr. David Kriegman and Kevin Barnes. The scalability, and robustness of our computer
vision and machine learning algorithms have been put to rigorous test by more than 100M users who have tried our products.
Read More
(https://learnopencv.com/about/)
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Privacy policy
(https://learnopencv.com/privacy-policy/)
Accept
https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/?utm_source=rss&utm_medium=rss&utm_campaign=… 21/21