I'm wondering about the number of classes in Tensorflow's Inception implementation.
In their training script , they load the training set consisting of images and labels. Next, to calculate the loss, they define the number of classes as:
# Number of classes in the Dataset label set plus 1.
# Label 0 is reserved for an (unused) background class.
num_classes = dataset.num_classes() + 1
You can see that they use an "unused background class". You can also see this approach when they create their training set: build_image_data.py
So, why would you need such an unused background class? (Especially because you get one additional but useless prediction from the output layer)
It's a convention we use for all our image datasets, and it didn't seem worth the trouble to break it for this particular model. As an aside, I wish all academic classification datasets had a 'none of the above' class in their test evaluation. A classifier which doesn't know when it doesn't know is not that useful in practice. (vanhoucke)
https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/9G-c2K_GCmk
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.