Specific Object Recognition with Tensorflow Object Detection API

In the development of Artificial Intelligence technologies, which is one of the most frequently used fields of our age, there is a scientific area known as Computer Vision, which includes Image Processing stages🌎.  In order for a data to be processed, it must be understood first. However, the meaningful data can pass to the artificial learning stage. In order to make sense of the data, it must be passed through certain pretreatment stages. The preprocessing of the data should be determined as appropriate steps towards the desired targetIt will be sufficient for you to know these steps in data mining as a basis. For this reason, I intend to briefly move on to the object recognition section, which is the main subject of the article. The figure below shows the processing and interpretation of an image as input.

Data Mining Stages

As you know, object and face recognition is almost everywhere in our lives! In daily life, we face many examples such as mobile phones, computers, security cameras that work with special object recognition sensors 📱🖥️. All of these basically run image processing steps in their infrastructure. Object recognition algorithms perform object identification on data (image, etc.) based on certain categories. Many object recognition algorithms create a frame (frame) on the image, by scrolling all the pixels in the image with the method of shifting this frame and providing classification by passing the recorded image segments through neural networks [1]. There are many object recognition models in the literature such as CNN, RCNN, Faster RCNN, YOLO, VGG16 [2]. In these models, ROI (Region of Interest) regions are created by determining region based frames in the image [3]. The learning process is carried out by passing the determined ROI regions through the Evolutionary Neural Network (CNN). Depending on the objects to be detected and the images to be worked on, training is carried out by selecting different neural network models. As the existing object recognition models are briefly mentioned, we can proceed to the analysis of object detection by using the Tensorflow Object Detection API provided by Google. Tensorflow is an open source platform made available by Google for machine learning [4] Thanks to the models included, many studies in the field of data science have been carried out and the problems encountered during machine learning have been eliminated and it is a treasure for data scientists and those working in the field of artificial intelligence💰. You can obtain the models provided by Tensorflow and Object Detection API files that we will use for object detection from the link below ⬇️

🛎️ https://github.com/tensorflow/models [5]

There is a very useful description on the Github page for the use of Tensorflow API models. As shown in Figure 2, you can perform the installation in order by clicking on the Installation section under the Table of contents heading 📝

  ⚡ This page contains operating instructions for Linux OS only. I will explain the setup in order for those using Windows OS.

The libraries specified in the Dependencies section on the page are required for the models available in the Tensorflow API infrastructure to work. Each of the libraries needs to be loaded completely. Please let’s continue on our way, making sure that they all work.

📌 If you are using Anaconda, these libraries will be loaded by default when you install Tensorflow from the package files as shown in Figure 3. You can control it.

🧷 Required libraries for installation [6]

  • Protobuf 3.0.0
  • Python-tk
  • Pillow 1.0
  • lxml
  • tf Slim (which is included in the “tensorflow/models/research/” checkout)
  • Jupyter notebook
  • Matplotlib
  • Tensorflow (>=1.12.0)
  • Cython
  • contextlib2
  • cocoapi

📌 Let’s install one of the commands below to install Tensorflow on the computer [6].

 # For CPU
pip install tensorflow
# For GPU
pip install tensorflow-gpu

To install the model file on our computer, let’s download Tensorflow Object Detection models as shown in Figure 4.

hile downloading the model, let’s download Protobuf, which will take part in the transmission of the data, by adding a link to the Python paths stored on the computerAs it works with other versions, I prefer Protoc v3.4.0 as shown in Figure 5, if you wish, you may choose another version.

When you enter the research folder among the downloaded models, you will notice that it contains many different models. Since the files related to object detection are in the object_detection folder, you can examine the Python files in this folder. As you can see in Figure 6, I leave a small image with the models together for your review📌

Preview of Model Files

Then, in order to load the Proto files, first write the path of the downloaded protoc file, then copy the protoc command found on the installation page and compile it as shown in Figure 7.

💡 The platform on which programming will be written can be selected as required. I will continue with the Jupyter platform so that the processes run faster on the server (localhost) and files can be stored.

🔗 Platform name : Jupyter Notebook

I copied it into Jupyter projects as it will work in the object_detection folder downloaded in the model folder. As shown in Figure 8, we will continue the operations on the object detection model running on Localhost. You can run the object detection module by following all the steps I have done in turn 📂

Object Detection Module

Object Detection Tutorial

Compiling Module Codes

⏳ Let’s take a short break while compiling the codes, if you wish, you can examine the content and examine which models are run.

When the object recognition model is run on an image that is used frequently in object recognition, the following results are obtained. With this open source model provided by Tensorflow, it is possible to recognize objects in any image🔍

Running Object Recognition Model [6]

REFERENCES

[1] Software Development, “Face and Object Recognition with Computer Vision – R-CNN, SSD, GANs”, Udemy, https://www.udemy.com/course/bilgisayar-gorusu/#instructor-1.

[2] Ross Girshick, “The IEEE International Conference on Computer Vision (ICCV) FAST R-CNN”, 2015, pp. 1440-1448, IEEE, https://ieeexplore.ieee.org/document/7410526.

[3] From Wikipedia, Free Encyclopedia, “Region of interest”, September 2012, https://en.wikipedia.org/wiki/Region_of_interest.

[4] Tensorflow Official Website, “Tensorflow”, https://www.tensorflow.org/.

[5] Tensorflow, “Tensorflow Models”, Github, https://github.com/tensorflow/models.

[6] Tensorflow, “Tensorflow Installation”, Github, https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md .

Related Posts

Leave a Reply