Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create an xml file for dlib training

Tags:

xml

dlib

I'm trying to create an XML file by exploiting the imglab tool provided by dlib. I have a dataset of 21 images each with a single face. I must affix on each 68 landmarks at my leisure.

The file created with my landmarks is different from the XML file provided by dlib : namely each record is defined as a single box and should be considered as a part of the main box with containing the face.

Help me!

like image 985
B.Taf Avatar asked May 12 '16 14:05

B.Taf


2 Answers

Looks like you are trying to draw boxes manually around every face feature instead of using "part selection" mode

imglab -h will show you this:

--parts The display will allow image parts to be labeled. The set of allowable parts is defined by which should be a space separated list of parts.

Try this:

  1. Create xml file for some images directory

    imglab -c xml_file_name.xml /path/to/images/folder

  2. run imglab with --parts argument:

    imglab --parts "1 2 3 4 5 6 7 8" xml_file_name.xml

This will make imglab know about 8 features possible to annotate in box area

  1. After imglab opened - draw box, select it (should be blue) and right-click inside - you will get popup menu for part selection

Also consider reading help/about in imglab for using instructions

After saving xml file you will get something like this:

  <image file='1\a1.jpg'>
    <box top='26' left='33' width='78' height='73'>
      <part name='1' x='67' y='68'/>
    </box>
  </image>
like image 79
Evgeniy Avatar answered Nov 12 '22 09:11

Evgeniy


Evgeniy's answer is useful but when running imglab with --parts argument, numerical labels should be like:

imglab --parts "01 02 03 04 05 06 07 08 09 10 11 12" xml_file_name.xml

Otherwise, since dlib sorts the parts by name in xml, labels will be confusing while predicting.

like image 40
Dr. Mehmet Ali ATICI Avatar answered Nov 12 '22 08:11

Dr. Mehmet Ali ATICI