ryouchinsa / Rectlabel-support

RectLabel is an offline image annotation tool for object detection and segmentation.
https://rectlabel.com
511 stars 73 forks source link

Can't do Tensorflow training if attributes are used in addition to classes #125

Closed kkalle closed 5 years ago

kkalle commented 5 years ago

I'm using ReactLabel to prepare training data for Tensorflow object detection. I export the label map, train.txt and test.txt and use the Python script to create TF record files for training. It works well if I only use classes but if I also include an attribute like color, the training doesn't work at all.

It seems that the label map doesn't match the object names in the annotation .xml files and therefore the Tensorflow training doesn't work. How can I fix this issue?

ryouchinsa commented 5 years ago

Thanks for writing the issue. When you combine the object and attributes, '-' is replace with '_' in the object name. This is because '-' is used as separators among the object and attributes.

Are you using this script to convert to the tfrecord file? https://github.com/ryouchinsa/Rectlabel-support/blob/master/rectlabel_create_pascal_tf_record.py

def getClassId(name, label_map_dict):
    class_id = -1
    for item_name, item_id in label_map_dict.items():
        item_name_underbar = item_name.replace('-', '_')
        if item_name in name or item_name_underbar in name:
            class_id = item_id
            break
    return class_id
ryouchinsa commented 5 years ago

Currently If you need our support to fix this problem, please let us know.