bit-bots / imagetagger

An open source online platform for collaborative image labeling
MIT License
267 stars 54 forks source link

Support PASCAL-VOC-like export format #13

Closed corenel closed 6 years ago

corenel commented 6 years ago

I notice that placeholders in Create new Exportformat page isn't sufficient to create a PASCAL-VOC-like export format.

For example, PASCAL VOC format looks like this:

<annotation>
    <folder>demo</folder>
    <filename>demo3.jpg</filename>
    <path>/home/yuthon/Workspace/demo/demo3.jpg</path>
    <source>
        <database>Unknown</database>
    </source>
    <size>
        <width>799</width>
        <height>401</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>class-1</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>487</xmin>
            <ymin>107</ymin>
            <xmax>790</xmax>
            <ymax>318</ymax>
        </bndbox>
    </object>
    <object>
        <name>type-f</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>141</xmin>
            <ymin>68</ymin>
            <xmax>363</xmax>
            <ymax>334</ymax>
        </bndbox>
    </object>
</annotation>

The filename and path part isn't shown on given placeholders, thus it's impossible to create a PASCAL-VOC-like export format.

I'll appreciate it if you could supply more placeholders, or directly support built-in PASCAL-VOC-like export format.

NFiedler commented 6 years ago

Thank you very much for your contribution and your ideas! I don't want to directly implement any format because i want to keep the flexibility at the highest possible level. So i'd rather add functionality to the export creation itself. As far as i see, the path is the only problem here. The filename has the %%image placeholder. Because the path to the file depends on the system i'd recommend using a shell variable (e.g. export IMAGE_SET_PATH='/home/nfiedler/Bit-Bots/imagetagger') and saving the images in a directory in that path named after the imageset. Then you could use the export format as follows:

<folder>%%imageset</folder>
<filename>%%image</filename>
<path>$IMAGE_SET_PATH/%%imageset/%%image</path>

Therefore the %%imageset placeholder is needed in the annotation format. This is missing right now.

corenel commented 6 years ago

Thanks for your help! I'v tried this:

Of course, if you're focusing on add other useful features which is much more important, I can also write a tiny Python script to convert the current all-in-one annotation file into what I desired. That's quite easy.

Thanks for your great contribution on building such an excellent image labelling tool!

NFiedler commented 6 years ago

Now i understand the problem. I think two features are needed to realize this functionality:

The aggregation of annotations by image would make it very easy to split the file locally until the splitting feature is implemented.

corenel commented 6 years ago

Thanks for your quick reply! Then I'll write my own scripts for temporary use and wait for the splitting feature.

NFiedler commented 6 years ago

Meanwhile the aggregation by image is possible and the additional placeholders are implemented. I wouldn't like to have the splitting feature on our hosted version, because it leads to a high server load (creation and zipping of thousands of files for large imagesets), and is easily achievable with a simple script on the client side.