wenet-e2e / wespeaker

Research and Production Oriented Speaker Verification, Recognition and Diarization Toolkit
Apache License 2.0
704 stars 116 forks source link

mini-batch with no duplicate speaker_id #195

Closed ductuantruong closed 1 year ago

ductuantruong commented 1 year ago

Hi Wespeaker team,

Thank you for sharing your amazing work. I am trying to use your work in my research. However, I am not familiar with the data sampler using your toolkit. Could I ask how to modify your data sampler so that in a mini-batch, each training sample has a different speaker_id (no duplicate speaker_id in a mini-batch)?

Thank you for your support!

JiJiJiang commented 1 year ago

image I think one simple method is to re-define your collate_fn in the dataloader, and filter the training samples of the same spk_id with a batch. Although the actual batch_size could be a little smaller after filtering, the training process should be normal. You can refer our similar usage of customized collate_fn in ssl/dataset.py. Hope this solve your problem.

ductuantruong commented 1 year ago

Thank you for your suggestion! I will try that.

mmmmayi commented 11 months ago

Then if I want to use triplet loss and a batch contains N speakers with M different utts for each speaker, can I modify your data sampler?