There has been a significant and successful expansion of computer vision research in recent years. Much of this success can be attributed to the adoption and the adoption of machine learning. While others can be attributed to the invention of innovative representation, and models for specific computer vision issues, object detection is the one area that has made significant improvement.
But you can meet the curve with our professional certificate program in AI and machine learning, co sponsored by Purdue University and IBM, which is designed after simply an intense bootcamp learning model, AI and ML certification course. This course covers tools and techniques like Python, TensorFlow, Keras, NLT, Kay and many more, along with industry project like social media, by Twitter delivery service provider by Zomato, transportation service provider by Uber, and many more amazing projects. So choosing the scores, you can get hired on renowned companies like Google, Amazon, LinkedIn, and Adobe and an average salary high cost 70%. So what are you waiting for? Join the AI animal certificate program and accelerate your career in artificial intelligence. The link is in the description box below. Before starting let us have a simple question to brush up on your knowledge.
So open CV stored RGB pixels in what order GBR RGB VGA and BRC is answer in the comment section below and we will update the current answer in the pinned comment. Or you can pause the video give it a thought and as in the comment section. Before we move on to the programming part, let’s discuss what Open CV is and proceed further for the same. Open CV open source computer vision library is an open source computer vision and machine learning software library. It isn’t in C++, but as a binding for various programming languages such as Python, Java, MATLAB, open CV was designed with a goal of providing a common infrastructure for computer vision applications and to accelerate the use of machine learning perception. In commercial product.
Open CV is widely used in a variety of industries, including robotics, automotive, and healthcare. It’s supported by a large community of developers, researchers and users who contribute to its development and provide support to its users. It is supported by a large community of developers, researchers and users who contribute to its development and provide support to its users. So now let’s see what is object detection. object detection is a computer vision technology that involves identifying and localizing the object of interest within an image or video. It is a challenging task as it involves not only recognizing the presence of an object, but also detecting its precise location and size.
Within the image or video object detection algorithm typically used deep learning techniques such as CNN to analyze the image or video for identifying the objects these algorithm can also determine the boundaries of the object by drawing a bounding box around them. So after understanding what is object detection, now let’s move on to the programming part. This is a corner Python kernel here we will change this name. So here I will write object detection demo okay. So, the first we will import some major library like open CV so for that we will write import CV to and the next one is import matplotlib. Pipe lot as PLT. So why we are writing PLT because we can’t write again and again matplotlib.pi plot. Okay, it’s a long one.
So we can write a short form PLD. So, yeah, let’s do this. So what is open CV? Open CV is an open source software library for computer vision and machine learning. Open CV fill form is open source computer vision library it was created to provide a shared infrastructure for application for computer vision and to speed up the use of machine learning perception in consumer products. Open CV as a BSD license software make it simple for companies to use and change the code. Okay, so there are some predefined packages and libraries that make our lives simple and open CV is one of them again what is matplotlib matplotlib is an easy to use and an amazing visualize library in Python.
It is built on numpy array and designed to work with broader sci fi stuff It consists of several plots like line bar, scatter histogram and many others. Okay. So moving forward we will import our file, okay. So here I will write config file because this is our file name SSD underscore mobilenet V three large Coco 22 fourteen.vb Okay. So you can find this file under description box below frozen model explain you every single thing in furtherance of DOD PV. Okay, so let me run it first, mobile and as the name implies the mobile lead model is designed to use in mobile application and it’s TensorFlow first mobile computer vision model will not use depthwise separable convolutions.
It significantly reduces the number of parameter when compared to the network with regular convolutions. With the same depth in the rights. This is only in the lightweight of the deep neural network. So mobile net is a class of CNN that was open sourced by Google and therefore, this gives us an excellent starting point for training our classifiers that are insanely small and insanely fast. Okay, so what is this large cocoa. This is a data set cocoa dataset, like with applications such as object detection, segmentation and captioning. The cocoa dataset is widely understood by the state of the art of neural network. Its versatility as a multiple per seen variation, so best to train a computer vision model and benchmark its performance. Okay, so what is cocoa? The common object and context is one of the most popular large scale label images data set available for public use.
It represent a handful of objects we encounter on a daily basis and contains image notations in 80 categories, I will show you the categories I have with over 1.5 million object instances. Okay, so, modern day AI driven solution is still not capable of producing absolute accuracy and result, which comes down to the fact that cocoa dataset is a major benchmark for CV to train, test, and polish refined models for faster scaling of the innovation pipeline. On top of that the cocoa dataset is a supplement to transfer learning, where the data use for one model serves as the starting point for the another. So what is frozen inference? Well, like freezing is a process to identify and save all the required graphs, like weights, and many others in a single file that you can usually use a typical TensorFlow model contains four file and this can contains a complete graph. Okay, so our let’s create one model that I will add more than once to see v2 dot dnn.
Done was the config file giving the parameters to parameters like frozen model and config file scroll here Yeah, you don’t need first Okay, there it is. Okay, so as you see we do dot dnn detection model return is deserved an exception set. The question comes what is the meaning of detection model or dnn detection model? For this class to present a high level API for object detection networks. Detection model allows to set parameters for pre processing input image detection model creates net from file and with trained weights and config sets it processing input runs forward pass and return the result detection. Okay, moving forward let’s set the class labels Okay, class labels
I’ll name labels dot txt I will put this file on the description box no you can order from the open file name.
So here I created one array of named class labels. So this is the file name what I’m doing I’m putting this label file into this class labels. Okay? So here if I will print class labels these are the 80 categories in the cocoa dataset. Okay, this person bicycle, car motorbike aeroplane verse train these all are the two categories I will put this file label dot txt in the description box below you can find download from them okay fine so let’s print the length of the cocoa dataset or you can see class labels this ad as you can see, I’ve already told you the length will be at So here let’s set this some model input sizes scaling mean and all so read your model DoD said would rise to 20 comma DoD said input scale and burn zero says 130 7.5 Okay, I will explain you don’t worry model dot said that input me wondered is 7.5 comma 120 7.5 comma 120 7.5 Okay and then model don’t send would
be will be what is set input size okay. So, setting boot size is a size of new frame the shape of the new blob less than zero okay. So, this isn’t the size of the new frame.
The second one is set input scale Set Input scale is a scale factor of the value for the frame or you can say the parameter will be the multiplier of the frame values or you can say multiplier for different values. So, it didn’t put me so, it said the mean value for the frame the frame in which the photo will come the video will come or my webcam will come. So, it said the mean value for the frame are the four parameters mean is killer with the mean values which are subtracted from the channels you can say and the last one is set inputs to have RB So, if set the flags to appear before the every frame, we don’t have to put every time a single frame for a particular image it will be set the true for the all the images okay.
So parameters will be shared by the flag which indicates a swift first and the last channels. So moving forward we will vote when image
read boy dot jpg d dot I am sure so, this is the size of T 20 by 20 Okay, so, first thing is you can download this the random nature from the Google I do from Google itself. So now what we will do we will set the class index the confidence value in the box the box is the boundary box which I will create for that particular person cycle motorbike and the guard.
that works the bounding box and I will add your CV to dot rectangle make the rectangle the image boxes if from us zero comma zero is the color of the box and this will be the thickness Okay then I will write CV two dot put XT image first labels like class index minus one because always index starts with zero that’s fine and the boxes zero and boxes So Jimmy, RGB so we don’t have to write again and again it will convert all the files into RGB Isn’t it
okay as you can see the motorbike is coming. Bicycle is coming the person is coming the car will come the car is coming. Okay, so detecting the right for the image.
Now we will do this for the video and for the webcam We are done with this image one and then I will right here okay so, this is video for the video or the video I will right here we go to capture you can write any name so CV to dot video capture so, you can take any random video I do this Pexels
and open the video yeah everything will be the same font scale goes to three okay and it goes to C two dot font or che
okay so, here I will write vile throw a frame question to gab dot sheet this further reading of the file the same I will write class index comma confidence my boundary box was to model dot detect and the confidence threshold was to 0.55 okay everything is the same we did before so, I will print index okay.
So, here I will write if and the class index does not equals to zero and what to perform is here after add for class index Alma confidence grandma boxes in SIP OS X flatten, flatten is a layers okay going through these flatten walks if class index is greater than equals to AD and what to do? Then I will copy from here the same thing I put out here Here I will read CV to dot I’m sure this will be the data and in the frame object detection by simply learn frame if CV two dot weight key k two and zero FF x plus two o r d Q Okay then yeah I will write a drink will you break when guardian to to the weight key will be to okay I will tell you what is the weight here I will read gap dot release and see v2 dot destroy on Windows okay cool now let me done let’s hear a little better okaythe Python programming models we run it again David keys okay video is here the video is here as you can see it’s the bicycle the person the person the bus car, traffic light person person.
So our object detection for the video is coming right? Okay person okay person traffic light this is how you can do what’s the video okay so now let’s we will do for the webcam live. So this is for the video. So if we want to do for the webcam with Okay, so we need to just change when one thing only we have to change instead of giving the file we have to write one here okay, the rest will be the same for it. So I have to just shut down my webcam. So let me shut down the webcam and get back to you
Well, as you can see, that’s a device here on the box. So so this is coming right okay. So if I will show this the mobile phone is coming right now.
Okay, so this is how you can do the correct object detection. Okay. So if you enjoyed this video, and if you want this full code how to do so you can come in for the same okay, if you want this full code, you can come in for the same one call. And if you have any queries related to Python machine learning you can come in for the same so if you enjoyed this video, please do subscribe to our YouTube channel and press the bell icon to never miss any update from simpler.