I'm trying to train a triplet loss model with tensorflow and keras. I'm using the VGG16 model to create a 2622 embeddings from my dateset.
I use the tfa.losses.TripletSemiHardLoss as my loss function. I want to add some kind of accuracy function to the training process because I feel that only tracking the loss is not enough. I know that I can use a custom function with the "metrics" argument in the model "compile" function, but I'm not quiet sure what kind of function do I need for the triplet loss training. I thought of taking the semi_hard_triplet_loss function that tensorflow implements and divide the number of positive triplet by the number of all valid triplets.
accuracy = 1-(positive_triplet/all_valid_triplets)
where positive triplets means all triplets that has loss > 0.
Is that the right way to go?