taylorlu / Speaker-Diarization

speaker diarization by uis-rnn and speaker embedding by vgg-speaker-recognition
Apache License 2.0
455 stars 124 forks source link

feats = np.array(feats)[:,0,:] # [splits, embedding dim] IndexError: too many indices for array #30

Open vnylp opened 4 years ago

vnylp commented 4 years ago

for epoch in range(7000): # Random choice utterances from whole wavfiles

A merged utterance contains [10,20] utterances

    splits_count = np.random.randint(1, 5, 1)
    print('this is splits_count',splits_count,splits_count[0])
    path_spks = random.sample(path_spk_tuples, splits_count[0])
    utterance_specs, utterance_speakers = load_data(path_spks, min_win_time=500, max_win_time=1600)
    feats = []
    for spec in utterance_specs:
        spec = np.expand_dims(np.expand_dims(spec, 0), -1)
        v = network_eval.predict(spec)
        feats += [v]
        print(np.array(feats))

    feats = np.array(feats)[:,0,:]  # [splits, embedding dim]
    train_sequence.append(feats)
    train_cluster_id.append(utterance_speakers)
    print("epoch:{}, utterance length: {}, speakers: {}".format(epoch, len(utterance_speakers), len(path_spks)))

np.savez('training_data', train_sequence=train_sequence, train_cluster_id=train_cluster_id)

I changed np.random.randint(1, 5, 1) to 1 to 5 as i have only 4 speaker dataset as given. I am getting an error at line

feats = np.array(feats)[:,0,:] # [splits, embedding dim]

main() File "generate_embeddings.py", line 196, in main feats = np.array(feats)[:,0,:] # [splits, embedding dim] IndexError: too many indices for array

jeremy110 commented 4 years ago

you must assure the shape of feats is right.For example:(256,512),the 512 is your observation_dim