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

Issue in Using test_features in UIS_RNN #17

Open rohithkodali opened 5 years ago

rohithkodali commented 5 years ago

HI HarryVolek,

I have created embeddings for Timit model and generated the d-vectors as you explained in README but when i try to test the features in USI_RNN it throw the following error

"ValueError: test_sequence must be 2-dim array." guess we need to reshape the test_sequence

HarryVolek commented 5 years ago

Hi rohithkodali,

It's true, the test_sequence will need to be sliced to be compatible with UIS-RNN. I plan on revisiting the script in the near future.

kouohhashi commented 3 years ago

FYI. I tried to split entire test set by exact 100 utterances.

test_sequences_2 = []
test_sequences_block = []

test_cluster_ids_2 = []
test_cluster_ids_block = []

count1 = 0

for test_sequence, test_cluster_id in zip(test_sequences, test_cluster_ids):
    test_sequences_block.append(test_sequence)
    test_cluster_ids_block.append(test_cluster_id)

    count1 = count1 + 1
    if count1 != 0 and count1 % 100 == 0:
        test_sequences_2.append(test_sequences_block)
        test_sequences_block = []
        test_cluster_ids_2.append(test_cluster_ids_block)
        test_cluster_ids_block = []

test_sequences = test_sequences_2
test_cluster_ids = test_cluster_ids_2

The accuracy was about 70%. Not that great. May be because of splitting methods...

good5dog5 commented 2 years ago

Thanks for @kouohhashi. I insert the patch into demo.py of uis-rnn but still getting ValueError: test_sequence must be 2-dim array.

I modified it as following and work!

  test_seq_2 = []
  test_id_2 = []

  batch_seq = []
  batch_id = []

  count = 0
  for test_sequence, test_cluster_id in zip(test_sequences, test_cluster_ids):

    batch_seq.append(test_sequence)
    batch_id.append(test_cluster_id)

    count +=  1
    if count != 0 and count % 100 == 0:
        test_seq_2.append(batch_seq)
        batch_seq = []

        test_id_2.append(batch_id)
        batch_id = []

  # (45,100,256) -> [array(100,256), array(100,256) .... ]
  res = np.empty(len(test_seq_2), object)
  res[:] = [np.array(a) for a in test_seq_2 ]

  test_sequences = res
  test_cluster_ids = test_id_2