In the paper it has mentioned how they consider classification and localization loss . But it is not clear how the TF-OD API for SSD model does that. Can any one brief this ?
First of all it is necessary to understand the loss function .
1. Localization loss
2. Classification Loss
You can read the SSD paper inorder to explore more about the loss .
So from this function it's important to make sure you understand only the positive examples (Predictions with some object) will take to the Localization loss and set of selected positive and negative examples will take to the classification loss .
Here the Xij is the similarity of default boxes at each location to ground truth boxes
We call this as Localization Weight - 1 or 0 with similarity matching
The Tensorflow object detection do the same but it uses an training method called Online hard example mining
You can read more about with this script in object detection API
Here I will point out what is actually happening ,
- First we calculate classification and localization loss for all the default boxes
Then we will extract boxes with highest number of losses (Hard Examples) - Here in the API it takes only the classification loss to select the hardest examples because if we get regression losses they can be zero for negatives as in the ssd loss function .
Then we select number of positives and negatives from the given number of hard examples (We can change it if number of positives are low we can maximize the size of hard examples ) . There will be lost of negative examples
When selecting the number of positive and negative examples from the list there should be a certain ration . Normally we take number of negatives should be 3 times as the number of positives .
Then for each indices we calculate the classification and localization loss and back propagate it .