For example, I finetuned a VGG network using my own data set, with only 2 labels foo and bar. I have converted images to tf.record using an example via this link:
labels_to_class_names = dict(zip(range(len(class_names)), class_names))
dataset_utils.write_label_file(labels_to_class_names, dataset_dir)
I'm going to build an API to predict images based on this new model, my question is: Is there any formal way to get the label string from the checkpoint files, or from the data set (for example predict_image("abc.png") returns foo string)? Since I have no clue which node in the logits layer that represents label foo, and which one represents bar
I've tried searching around but no help, and I'm still a tensorflow noobie.
The model (and incidentally the checkpoint files) do not have the name of each classes. All it has is a certain number of output neurons, the first one corresponding to the first class, the second one to the second class and so on.
If you want to know which one is which, look at the label file created by this line (most likely named labels.txt):
Alternatively you can inspect the contents of the
labels_to_class_namesdict:-> value at index 0 in the output of the model = class 'aaa', etc