espnet2.spk.loss.aamsoftmax_subcenter_intertopk.ArcMarginProduct_intertopk_subcenter
espnet2.spk.loss.aamsoftmax_subcenter_intertopk.ArcMarginProduct_intertopk_subcenter
class espnet2.spk.loss.aamsoftmax_subcenter_intertopk.ArcMarginProduct_intertopk_subcenter(nout, nclasses, scale=32.0, margin=0.2, easy_margin=False, K=3, mp=0.06, k_top=5, do_lm=False)
Bases: AbsLoss
Implement of large margin arc distance with intertopk and subcenter:
Reference: : MULTI-QUERY MULTI-HEAD ATTENTION POOLING AND INTER-TOPK PENALTY FOR SPEAKER VERIFICATION. https://arxiv.org/pdf/2110.05042.pdf Sub-center ArcFace: Boosting Face Recognition by Large-Scale Noisy Web Faces. https://ibug.doc.ic.ac.uk/media/uploads/documents/eccv_1445.pdf
- Parameters:
- in_features – size of each input sample
- out_features – size of each output sample
- scale – norm of input feature
- margin – margin
- cos (theta + margin)
- K – number of sub-centers
- k_top – number of hard samples
- mp – margin penalty of hard samples
- do_lm – whether do large margin finetune
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(input, label)
Defines the computation performed at every call.
Should be overridden by all subclasses.
NOTE
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
update(margin=0.2)