Object Detection (Part I)

The most fundamental computer technology related to Computer vision and Image Processing is Object Detection. It deals with detecting the semantic object of a certain class in digital images and videos. Have a look on the images, bellow.

object detection
Object detection with YOLO

object detection
Detecting home objects


Here, we can see that the model can detect the home objects (chair, bag, laptop, bottle, laptop, bowl, cup etc.) and also the outer-home objects ( bus, bi-cycle, human, car etc.). 

Object Detection

Object Detection is a supervised learning technique by which the model can detect or predict the object present in the digital images or videos. We can make our own object detecting tool using python with the help of Computer vision with deep learning model ( Here we have used YOLO model ).
In this post we are going to create our own object detecting model in python. As this is the PART-I, I will keep this very simple but FPS(Frames Per Seconds) will be very low due to its simplicity. In the next post, I will implement the same thing with a little more complex with improved FPS. 

Pipeline for Object Detection

  • First of all, We need to train the deep learning based model but here we use some python libraries ( Specifically, ImageAI and cvlib ) in which this process is internally trained already. In the next post, we will use YOLO as out trained model.
  • We will take a image with different objects.
  • Feed the image to some function which will detect the objects in the image/frame and return the bounding-box and labels associated with each objects present.
  • We can do some processing after that for our custom detection.
Frankly speaking, these python libraries are very easy to use and self-explanatory. This is the reason I have used for the first time.

Python code for Object Detect (using ImageAI library)

  • First, importing the required libraries
python code
  • start the Video capture object and run a while loop till the 'ESC' button is pressed.
  • create a detector object which will detect the objects in an image and save the image in the hard-disk.
NOTE:  You have to download the 'yolo.h5' file, from the git repositories of imageai.

python code
  • Display the image from the hard-disk.
  • At last, destroy all the windows and remove the saved image on the hard-disk. 
python code

Python code for Object Detect (using cvlib library)

The working of  cvlib  is also same as ImageAI. That's why I am providing only the code. If you are facing any problem, then please comment it down to the comment section. I will try to help you out.

python code

Conclusion

In this post we have learnt that ow to simply detect objects in a digital images or frames from the videos. In the next post, I will show how to do this same using only opencv and numpy 
library.






Comments

Popular posts from this blog

Distance measurement using opencv

Invisible Cloak using OpenCV