Auto-ReID-Fast
Auto-ReID-Fast copied to clipboard
Questions about triplet loss
Hi, I am wondering why the inputs of triplet loss are the same as cross entropy loss?
https://github.com/DuanYiqun/Auto-ReID-Fast/blob/c447ddf0bbb949e16c9521e9165603c4c3fb0570/models/losses.py#L64
def __init__(self, lamb = 0.5):
super().__init__()
self.lamb = lamb
self.cross_entropy = cross_entropy()
self.triplet_loss = TripletLoss()
def forward(self, inputs, labels):
return self.lamb*self.cross_entropy(inputs, labels) + (1-self.lamb) * self.triplet_loss(inputs, labels)
The inputs of cross entropy loss should be logits, while the inputs of triplet loss should be features. How does the triplet loss work in your code? I cannot find the exact implementation.
Sorry for the very late reply. I haven't looked at this repo for a long time. It seems this code version is not complete with the triplet loss. Since I was not the author of auto-re-id, I just tried to reproduce this paper similarly to you.
Yet, I remembered that when I tried the triplet loss on the server by changing the sampler. However, the difference is not that significant. And to split distributed triplet sampling is quite time-consuming from the other internal code base, so I didn't do this part.