Tensorflow -labeling classes needs ordered numbering

In most machine learning tutorials ,when it comes to labeling classes in object detection ,it usually start with 1 as in below .Is ordering important when labeling classes and giving them numbers such as id:1 ,id:2 ,etc. Can we give it different numbers like id:5000 where there is only few classes ? Can we start with id:1000 for example ? does the engine expect ordered numbers for classes

item {
item {
item {

I’m using transfer learning in tensorflow to train my own data ,I have some objects to train ,when I label them ,I didn’t give it ordered numbers starting from 1 ,I gave it different/random numbers like 89 ,100 .When the training is finished and I started to do inferencing ,the detected classes doesn’t show the numbers which I used for labeling ,it shows ordered numbers such as 1 ,2 ,4 etc. Those ordered numbers are not in my labels ,and they are annotating random areas in the image .I started to think ,this is the original model structure before I did the transfer learning .


I don’t know exactly which tutorial you are using but I don’t think it will work with random numbers.
What I’d expect is, the model will return an array with probabilities. Each position of the array is the probability for that class. If you mention id 5000, that would mean position 5000 of the array.
I think that the process is normalizing the ids to be a 1, 2, 3 and this might result in weird results.
I’d first try using a proper sequence of numbers and test with it.

does it makes sense?

You are right ,it seems the numbers need to be ordered .

But if that so ,then shouldn’t be start with id:0 not 1 ?

sometimes id 0 is marked as background but I’m not sure for this API specifically

I think he his talking about our label_map_utils.py in model garden:

As you can see in this section and in the next one:


1 Like

yes, according to the label_map_util.py, the id 0 is for background.