Klitter / Pyramidal_Person_ReID

A simple reproduction of Pyramidal Person Re-IDentification via Multi-Loss Dynamic Training (CVPR2019).
MIT License
34 stars 16 forks source link

question about triplet implement #3

Closed bochuanwu closed 4 years ago

bochuanwu commented 4 years ago

have you simply combine all the loss together? such as loss = [triplet(f, target) for f in feat] loss = sum(loss) / len(loss)

or loss with weight? my loss value can not reduce during trainig process.

Klitter commented 4 years ago

have you simply combine all the loss together? such as loss = [triplet(f, target) for f in feat] loss = sum(loss) / len(loss)

or loss with weight? my loss value can not reduce during trainig process.

Triplet loss easily meets gradient explosion because of space sparsity in training samples and gradient clipping helps to relieve this problem if you want to use Triplet loss during the whole training process. In my implementation, loss = cross_entropy in first 10 epochs and even epoch. In singular epoch, loss = cross_entropy + 0.14*triplet_loss.

bochuanwu commented 4 years ago

have you simply combine all the loss together? such as loss = [triplet(f, target) for f in feat] loss = sum(loss) / len(loss) or loss with weight? my loss value can not reduce during trainig process.

Triplet loss easily meets gradient explosion because of space sparsity in training samples and gradient clipping helps to relieve this problem if you want to use Triplet loss during the whole training process. In my implementation, loss = cross_entropy in first 10 epochs and even epoch. In singular epoch, loss = cross_entropy + 0.14*triplet_loss.

great! thank you for your help