I want to create my own .tfrecord files using tensorflow object detection API and use them for training. The record will be a subset of original dataset so the model will detect only specific categories.
The thing I dont understand and cant find any information about is, how are id`s assigned to labels in label_map.pbtxt during training.
What I do...
Step 1: assign label_id during creation of the tfrecord file, where I put my own ids:
'image/object/class/label': dataset_util.int64_list_feature(category_ids)
'image/object/class/text': dataset_util.bytes_list_feature(category_names)
Step 2: create labels file with e.g. two categories:
item { name: "apple" id: 53 display_name: "apple" }
item { name: "broccoli" id: 56 display_name: "broccoli" }
Step 3: Train the model
After training, there are some objects detected, but with N/A label. When I set the id`s starting from 1 then it shows correct labels.
My questions are:
- Why it did not map correctly to label with custom id?
- Can the second id have other value than 2? I'm sure I saw skipped ids in labels file for coco dataset.
- How to set the id to have custom value, if possible?
Thanks