Search Here

Custom Object Training using TensorFlow Object Detection API - Part 2

Welcome to the TensorFlow Object Detection API tutorial part 2. There are wide number of labelling tool but in this tutorial we will use LabelImg tool to annotate our downloaded images in the previous tutorial using "Google Images" and "Bing".




LabelImg - Image Annotation

What is LabelImg and why we use it?


To perform labelling task for image classification or image segmentation we use LabelImg tool. Its very easy for anyone to get started with LabelImg. There are many tools for labelling but in this tutorial we are going to use LabelImg. LabelImg tool is used to draw the bounding box around the interested object from an image in object detection. For example from an image of radio graphic teeth we need to draw a bounding box around the cavity (object of interest), to perform this activity we need labelling tool (In our case it would be "LabelImg"). These tools are allow us to put boxes around object(s).

Download Image annotation tool (LabelImg)


There are two links to download LabelImg tool, the first one is from github (if you use this than you need to download or clone the file and extract it to use that tool.) And the another is direct download (just download and use).

  1. LabelImg from github 
  2. LabelImg direct download

 Once running this tool, you should get a GUI window of that tool like below.

LabelImg - Image Annotation

Now click on "Open Dir" and select the directory where you have saved all the images in previous tutorial.

LabelImg - Image Annotation

Now its time to begin annotate the images. To annotate images select "Create\RectBox" button. Draw bounding box around the interest of object (In our case its cavity) and add readable name and press "Ok / save" to save your first annotation. Repeat this process for all the images. Below are some short keys to perform above steps.


  1. w:        To draw the bounding box 
  2. ctrl+s: To save the annotate image.


LabelImg - Image Annotation

Once you have annotate all the images, in result of annotation you have XML (automatically created) files for each images. For example if you have 100 images than in the result of image annotation you also have 100 XML files. The question is what is inside these XML files. These XML files contains the information of annotated images like (width, height, xmin, xmax, ymin, ymax). Below is sample of XML file.


<annotation>
        <folder>Images</folder>
 <filename>_Farha_25062018_102109.tif</filename>
 <path>C:\Users\Desktop\Images\_Farha_25062018_102109.tif</path>
 <source>
  <database>Unknown</database>
 </source>
 <size>
  <width>648</width>
  <height>587</height>
  <depth>1</depth>
 </size>
 <segmented>0</segmented>
 <object>
  <name>cavity</name>
  <pose>Unspecified</pose>
  <truncated>0</truncated>
  <difficult>0</difficult>
  <bndbox>
   <xmin>317</xmin>
   <ymin>260</ymin>
   <xmax>431</xmax>
   <ymax>375</ymax>
  </bndbox>
        </object>
</annotation>
        

In our next tutorial we will create TFRecords using these images and xml files.

Post a Comment

1 Comments