I am very excited to show you how to detect the Object in the image by yourself using the pre-trained Tensorflow object detection Deep Learning model.
If you are entering into the Deep Learning object detection, then this post will very helpful.
TensorFlow is a Deep Learning numerical library developed by Google. And the TensorFlow team offering the pre-trained object detection model. So I am going to check and execute the model on my Mac OS.
No prior knowledge of TensorFlow is required for this tutorial. Becuase, Here I am not going to explain how to create your own object detection model. I just simply exploring the pre-trained TensorFlow object detection model and will execute the model.
My Output from the TensorFlow Object Detection pre-trained model:
Detecting Robot(Enthiran in Tamil) movie robot as Person:-)
Detecting IronMan Suit as Person:-)
Enough theory. I usually directly jump into the code instead of reading more, not all time:-). So let's do the object detection model.
Python software is required. So download and install the latest python using the below link.
I used Python 3(At the time of writing this tutorial).
To install other python libraries we need pip.
To check whether you have installed the pip or not using
If the above command shows some version, you have installed the pip already.
If you have not installed pip, then download the pip using
Save the file and run below command in the terminal.
To know more about pip use the below link.
Download the object detection model from GitHub using
I downloaded this file to my Desktop/oddl folder. Extract the file and rename it to models.
The Tensorflow Object Detection API uses Protobufs to configure model and training parameters. Download the proto using
I downloaded this file to my Desktop/oddl folder. Extract the file and rename it to protoc.
Add the proto to the path using the below command.
Get protoc version using
Tensorflow Object Detection API depends on the following libraries:
tf Slim (which is included in the "tensorflow/models/research/" checkout)
Execute the below command one by one on your terminal to install the necessary libraries.
pip install tensorflow sudo pip install pillow sudo pip install lxml sudo pip install jupyter sudo pip install matplotlib
Before the framework can be used, the Protobuf libraries must be compiled. This should be done by running the following command from the tensorflow/models/research/ directory:
cd models/research/ protoc object_detection/protos/*.proto --python_out=.
Run the model using the below command.
cd object_detection/ jupyter notebook
The Jupyter will open in the browser. Click the object_detection_tutorial.ipynp file.
Click the Run All and wait for few seconds to see the output.
The output will be like this.
If your Jupyter Notebook asks the password and you don't know, then rest the password.
Reset Jupyter Notebook password using the below command on terminal.
jupyter notebook password
If you are not using the TensorFlow version 1.4 then it will raise an exception and will stop the execution.
So remove the version checking command from the above code.
Or upgrade the TensorFlow to latest version using
pip install --upgrade tensorflow
In this tutorial, you learned, how to detect an object on the image by yourself using the TensorFlow pre-trained object detection Deep Learning model.
All the codes and demos in this tutorial are executed using the Mac OS Sierra. The same steps apply for all other platforms(Windows, Linux). However, I have not executed on other platforms.