1

Has anyone had luck using the prepare_data method with data not exported from the Export Training Data tool in ArcGIS Pro? The documentation suggests prepare_data will take PASCAL_VOC_rectangles from other sources. 

I tried doing the following:

prep = prepare_data(path,dataset_type='PASCAL_VOC_rectangles')

but keep getting:

Please check your dataset. 26 images dont have the corresponding label files.

Per the 1.7 release of the Python API, the prepare_data should be able to take XMLs produced from LabelImg. This has not been working for me. 

The path variable is the path to my folder containing two subfolders, labels and images. Labels contains my XMLs and the images contains (you guessed it) my TIFs. I have tried to mimic how these folders are formatted like in the Export Training Data tool does, and I still cannot get it to work. Now I know the the Export Training Data tool creates some extra files beyond these folders, like .emdmap.txt, something else, but even when I delete these files, and run the prepare_data on the folder created from ArcGIS Pro, it works (but it doesn't work for my images and XMLs used through LabelImg). 

Folder structure matches in mine and Esri's. ​folder structure

----------------------------- DOES NOT WORK -------------------------
<?xml version="1.0"?>
<annotation>
    <filename>outtif_7500_2500.tif</filename>
    <source>
        <annotation>ArcGIS Pro 2.1</annotation>
    </source>
    <size>
        <width>2500</width>
        <height>2500</height>
        <depth>3</depth>
    </size>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1798</xmin>
            <ymin>1724</ymin>
            <xmax>1818</xmax>
            <ymax>1779</ymax>
        </bndbox>
    </object>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1305</xmin>
            <ymin>1502</ymin>
            <xmax>1361</xmax>
            <ymax>1525</ymax>
        </bndbox>
    </object>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1720</xmin>
            <ymin>1418</ymin>
            <xmax>1746</xmax>
            <ymax>1477</ymax>
        </bndbox>
    </object>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1084</xmin>
            <ymin>1092</ymin>
            <xmax>1145</xmax>
            <ymax>1115</ymax>
        </bndbox>
    </object>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1670</xmin>
            <ymin>727</ymin>
            <xmax>1737</xmax>
            <ymax>743</ymax>
        </bndbox>
    </object>
    <object>
        <name>car</name>
        <bndbox>
            <xmin>1902</xmin>
            <ymin>869</ymin>
            <xmax>1963</xmax>
            <ymax>884</ymax>
        </bndbox>
    </object>
</annotation>
-‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍--------------------------- WORKS ---------------------------------
<?xml version="1.0"?>
<annotation>
    <filename>000000001.tif</filename>
    <source>
        <annotation>ArcGIS Pro 2.1</annotation>
    </source>
    <size>
        <width>256</width>
        <height>256</height>
        <depth>3</depth>
    </size>
    <object>
        <name>1</name>
        <bndbox>
            <xmin>42.44</xmin>
            <ymin>128.19</ymin>
            <xmax>160.13</xmax>
            <ymax>226.85</ymax>
        </bndbox>
    </object>
</annotation>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0

I am uncertain what the exact problem was, but I changed the naming schema of my TIFs (it used to include two periods in the name, perhaps that was throwing things off) and set the save directory in LabelIMG before I started labeling objects.

Everything worked smoothly after that. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.