| | |
| | | """Speech2Diarlization class |
| | | |
| | | Examples: |
| | | >>> import soundfile |
| | | >>> import librosa |
| | | >>> import numpy as np |
| | | >>> speech2diar = Speech2DiarizationEEND("diar_sond_config.yml", "diar_sond.pb") |
| | | >>> profile = np.load("profiles.npy") |
| | | >>> audio, rate = soundfile.read("speech.wav") |
| | | >>> audio, rate = librosa.load("speech.wav") |
| | | >>> speech2diar(audio, profile) |
| | | {"spk1": [(int, int), ...], ...} |
| | | |
| | |
| | | """Speech2Xvector class |
| | | |
| | | Examples: |
| | | >>> import soundfile |
| | | >>> import librosa |
| | | >>> import numpy as np |
| | | >>> speech2diar = Speech2DiarizationSOND("diar_sond_config.yml", "diar_sond.pb") |
| | | >>> profile = np.load("profiles.npy") |
| | | >>> audio, rate = soundfile.read("speech.wav") |
| | | >>> audio, rate = librosa.load("speech.wav") |
| | | >>> speech2diar(audio, profile) |
| | | {"spk1": [(int, int), ...], ...} |
| | | |
| | |
| | | |
| | | @staticmethod |
| | | def seq2arr(seq, vec_dim=8): |
| | | def int2vec(x, vec_dim=8, dtype=np.int): |
| | | def int2vec(x, vec_dim=8, dtype=np.int32): |
| | | b = ('{:0' + str(vec_dim) + 'b}').format(x) |
| | | # little-endian order: lower bit first |
| | | return (np.array(list(b)[::-1]) == '1').astype(dtype) |