GithubHelp home page GithubHelp logo

satoshi66 / ge2e-loss Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cvqluu/ge2e-loss

0.0 0.0 0.0 4 KB

Pytorch implementation of Generalized End-to-End Loss for speaker verification

Python 100.00%

ge2e-loss's Introduction

GE2E-Loss

Pytorch implementation of Generalized End-to-End Loss for speaker verification, proposed in https://arxiv.org/pdf/1710.10467.pdf [1].

Includes an argument to define whether to use the 'softmax' or 'contrast' type loss (equations 6 and 7 respectively in [1]). Uses vector operations to speed up calculations of the cosine similarity scores for an utterance embedding against all the other speaker embedding centroids.

Below is some example code for how to use this. The example values for certain parameters are taken from [1]

import torch
from ge2e import GE2ELoss

criterion = GE2ELoss(init_w=10.0, init_b=-5.0, loss_method='softmax') #for softmax loss
criterion = GE2ELoss(init_w=10.0, init_b=-5.0, loss_method='contrast') #for contrast loss

N = 64 #Number of speakers in a batch
M = 10 #Number of utterances for each speaker
D = 256 #Dimensions of the speaker embeddings, such as a d-vector or x-vector

test_input = torch.rand(N, M, D)
loss = criterion(test_input) #output is a scalar
loss.backward()

[1] GENERALIZED END-TO-END LOSS FOR SPEAKER VERIFICATION, https://arxiv.org/pdf/1710.10467.pdf

ge2e-loss's People

Contributors

cvqluu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.