在使用Sidekit进行UBM说话人适应期间出现错误 [英] Got an error during UBM speaker-adaptation with sidekit
问题描述
我已经训练了UBM模型,现在当我遇到以下错误时,我正在尝试实现说话人自适应.
I've already trained a UBM model and now I'm trying to implement the speaker-adaptation when I got following error.
例外:show enroll/something.wav不在HDF5文件中
Exception: show enroll/something.wav is not in the HDF5 file
我在文件"feat"下有两个文件"enroll"和"test",分别包含用于训练和测试的功能(.h5),并且我的enroll_idmap是仅通过用于训练的音频(.wav)生成的.而且,我的wav文件和feat文件是分开的.我认为我遇到了idmap问题. "enroll/something.wav"是我的enroll_idmap的rightid,但是"HDF5文件"指的是什么?
I got two files "enroll" and "test" under the file "feat" which contains respectively features(.h5) for training and test, and my enroll_idmap is generated with the audios(.wav) only for training. And, my wav files and feat files are separated. I think I got a problem of idmap. "enroll/something.wav" is the rightid of my enroll_idmap, but what does that "HDF5 file" refer to?
谁能告诉我这个错误的含义以及如何解决?
Could anyone tell me what this error means and how to fix it?
这是我的enroll_idmap的代码
Here's the code of my enroll_idmap
def __init__(self):
BASE_DIR = "./Database/sidekit_data"
self.AUDIO_DIR = os.path.join(BASE_DIR, "audio")
self.FEATURE_DIR = os.path.join(BASE_DIR, "feat")
self.TASK_DIR = os.path.join(BASE_DIR, "task")
def create_idMap(self, group):
# Make enrollment (IdMap) file list
group_dir = os.path.join(self.AUDIO_DIR, group) # enrollment data directory
group_files = os.listdir(group_dir)
group_models = [files.split('_')[0] for files in group_files] # list of model IDs
group_segments = [group+"/"+f for f in group_files]
# Generate IdMap
group_idmap = sidekit.IdMap()
group_idmap.leftids = np.asarray(group_models)
group_idmap.rightids = np.asarray(group_segments)
group_idmap.start = np.empty(group_idmap.rightids.shape, '|O')
group_idmap.stop = np.empty(group_idmap.rightids.shape, '|O')
if group_idmap.validate():
group_idmap.write(os.path.join(self.TASK_DIR, group+'_idmap.h5'))
else:
raise RuntimeError('Problems with creating idMap file')
然后,我得到带有以下内容的enroll_idmap和test_idmap:
And after that I got enroll_idmap and test_idmap with :
create_idMap("enroll")
create_idMap("test")
这是说话者适应的代码,上面的错误在执行enroll_stat.accumulate_stat(...)时出现:
And here's the code of speaker-adaptation, the error above comes out during the execution of enroll_stat.accumulate_stat(…):
BASE_DIR = "./Database/sidekit_data"
enroll_idmap = sidekit.IdMap.read(os.path.join(BASE_DIR, "task", "enroll_idmap.h5"))
ubm = sidekit.Mixture()
model_name = "ubm_{}.h5".format(NUM_GUASSIANS)
ubm.read(os.path.join(BASE_DIR, "ubm", model_name))
server_eval = sidekit.FeaturesServer(feature_filename_structure="./Database/sidekit_data/feat/{}.h5",
...
...)
print("Compute the sufficient statistics")
enroll_stat.accumulate_stat(ubm=ubm,
feature_server=server_eval,
seg_indices=range(enroll_stat.segset.shape[0]),
num_thread=nbThread
)
这似乎不是什么大问题,但是它使我停了几天,请帮忙.
This seems not to be a big problem but it stops me for a few days, help please.
推荐答案
我终于解决了这个问题,方法是更改训练和测试功能的路径,使其不在"BASEDIR"之内
I finally got this problem fixed by changing the path of training and test features, making it outside the "BASEDIR"
server_eval = sidekit.FeaturesServer(feature_filename_structure="./enroll/{}.h5",
...)
这篇关于在使用Sidekit进行UBM说话人适应期间出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!