HarryVolek / PyTorch_Speaker_Verification

PyTorch implementation of "Generalized End-to-End Loss for Speaker Verification" by Wan, Li et al.
BSD 3-Clause "New" or "Revised" License
575 stars 166 forks source link

Question about L2 norm of embedding #27

Closed seandickert closed 5 years ago

seandickert commented 5 years ago

Thanks for this package. I was wondering about the L2 norm being applied in speech_embedder_net.py line 32. It looks like the paper describes an L2 norm being calculated per embedding and then dividing the embedding by that value. However, I believe the code as written calculates the norm over the entire matrix. Is this intentional? That is, I would have thought line 32 should be: x = x / torch.norm(x, dim=1).unsqueeze(1). This calculates the norm per embedding.

FengLeee commented 5 years ago

i find the same question. and i change to calculates the norm per embedding.

HarryVolek commented 5 years ago

Thanks for the observation, the issue has been fixed.