jymsuper / SpeakerRecognition_tutorial

Simple d-vector based Speaker Recognition (verification and identification) using Pytorch
MIT License
210 stars 46 forks source link

train with own dataset #20

Closed tuananh131001 closed 2 years ago

tuananh131001 commented 2 years ago

i got this when training with my own .p files


Training set 21600 utts (90.0%)
Validation set 2400 utts (10.0%)
Total 24000 utts

Number of classes (speakers):
240

<torch.utils.data.dataloader.DataLoader object at 0x00000218F4F8A710>
Train Epoch:   1 [       0/   21600 (  0%)] Time 3.002 (3.002)  Loss 5.5635 Acc 0.0000
Train Epoch:   1 [    5376/   21600 ( 25%)] Time 0.095 (0.113)  Loss 5.2005 Acc 1.3910
Train Epoch:   1 [   10752/   21600 ( 50%)] Time 0.032 (0.098)  Loss 4.7337 Acc 2.0177
Traceback (most recent call last):
  File "D:\Python\train.py", line 290, in <module>
    main()
  File "D:\Python\train.py", line 120, in main
    train_loss = train(train_loader, model, criterion, optimizer, use_cuda, epoch, n_classes)
  File "D:\Python\train.py", line 157, in train
    for batch_idx, (data) in enumerate(train_loader):
  File "C:\Users\TA\anaconda3\envs\Python\lib\site-packages\torch\utils\data\dataloader.py", line 652, in __next__
    data = self._next_data()
  File "C:\Users\TA\anaconda3\envs\Python\lib\site-packages\torch\utils\data\dataloader.py", line 692, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\Users\TA\anaconda3\envs\Python\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\TA\anaconda3\envs\Python\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\Python\SR_Dataset.py", line 195, in __getitem__
    label = self.spk_to_idx[label]
KeyError: 'wav'

Process finished with exit code 1

Help me pls

tuananh131001 commented 2 years ago

solved by putting the right input format when convert

    Converts the wav dir (in DB folder) to feat dir(in feat folder)
    ex) input         : '.../voxceleb/voxceleb1/dev/wav/id10918/oT62hV9eoHo/00001.wav'
    output_foldername : '.../voxceleb/voxceleb1/dev/feat/train_logfbank_nfilt40/id10918/oT62hV9eoHo'
    output_filename   : '.../voxceleb/voxceleb1/dev/feat/train_logfbank_nfilt40/id10918/oT62hV9eoHo/00001.pkl'