DanJun6737 / TransFace

[ICCV 2023] TransFace: Calibrating Transformer Training for Face Recognition from a Data-Centric Perspective
52 stars 7 forks source link

TopK tensor, weight, 2 loss #8

Closed ericyq closed 5 months ago

ericyq commented 5 months ago

TopK = TopK_ALL[:, :K] local_embeddings, weight, local_patch_entropy = backbone(img_fft) double loss: torch.Tensor = module_partial_fc(local_embeddings, local_labels, opt, local_patch_entropy)

above TopK tensor, weight,all not to used. 2 loss also was not used in combination.

DanJun6737 commented 5 months ago

Hi @ericyq ~

In fact, we implemente the weighting of the ArcFace loss function in the partial_fc_exp.py file, as the backward propagation of the ArcFace loss is defined in this file. Please refer to "class PartialFCAdamW".

ericyq commented 5 months ago

160th line, in train.py loss: torch.Tensor = module_partial_fc(local_embeddings, local_labels, opt, local_patch_entropy) here loss, isn't it not useful?

in addition, TopK tensor, is it not to used yet?

DanJun6737 commented 5 months ago

Actually, we use the loss function on the 190th line in train.py to optimize the model. We utilize TopK factors to guide the generalization of new samples (lines 158-191 in train.py).