mycrazycracy / tf-kaldi-speaker

Neural speaker recognition/verification system based on Kaldi and Tensorflow
Apache License 2.0
32 stars 16 forks source link

jumpahead is eliminated in python3 #10

Closed deciding closed 4 years ago

deciding commented 4 years ago

the jumpahead function of random module is eliminated in python3, I removed it in the code, and found that the eer got degradation. I just want to ask is this function useful in model training? I think the os.urandom can already gives us good randomness

mycrazycracy commented 4 years ago

Hi, The dataloader will load data parallelly. To make each speaker has the uniform probability to be sampled, each loading process must generate different sequence of random numbers. I add jumpahead to make the above idea to work and unfortunately, I haven't tried to remove jumpahead function. Theoretically, if the code can give you "enough randomness", the result should be okay. You can easily write a code snippet to confirm that without jumpahead. (just do data loading and check the loaded utterances). Please let me know if you try that.

deciding commented 4 years ago

@mycrazycracy Hi, there should be no problem of removing jumpahead. I checked:

  1. the os.urandom function returns different value for each process
  2. the feature output is different for each process, in below feature is actually feature[0][0][0] ('=========feature for seed: 0===========', -7.0374403)
    ('=========feature for seed: 4===========', 1.5457642)
    ('=========feature for seed: 8===========', -2.2676213)
    ('=========feature for seed: 0===========', -1.2826457)
    ('=========feature for seed: 4===========', 0.4482942)
    ('=========feature for seed: 6===========', 0.3874644)
    ('=========feature for seed: 9===========', 0.29251945)
    ('=========feature for seed: 7===========', -0.63542134)
    ('=========feature for seed: 1===========', 0.92588645)
    ('=========feature for seed: 4===========', -2.832041)
    ('=========feature for seed: 5===========', -0.14250559)
    ('=========feature for seed: 2===========', 2.2741497)
    ('=========feature for seed: 8===========', -0.8805731)
    ('=========feature for seed: 0===========', 1.890543)
    ('=========feature for seed: 3===========', 0.6882009)
    ('=========feature for seed: 9===========', -2.416298)
    ('=========feature for seed: 6===========', 1.4406425)
    ('=========feature for seed: 11===========', 0.7510144)
    ('=========feature for seed: 7===========', -1.460146)
    ('=========feature for seed: 13===========', -2.3520525)
    ('=========feature for seed: 4===========', -1.1657894)
    ('=========feature for seed: 1===========', 1.9376395)
    ('=========feature for seed: 5===========', 0.07079673)
    ('=========feature for seed: 12===========', -3.0508542)

Thus the misalignment on my side from your result is due to other thing. I will raise another ticket for this performance alignment.