Got an error during UBM speaker-adaptation with si

2019-06-03 06:17发布

I've already trained a UBM model and now I'm trying to implement the speaker-adaptation when I got following error.

Exception: show enroll/something.wav is not in the HDF5 file

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?

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')

And after that I got enroll_idmap and test_idmap with :

create_idMap("enroll")
create_idMap("test")

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.

1条回答
叼着烟拽天下
2楼-- · 2019-06-03 07:12

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",
                                     ...)
查看更多
登录 后发表回答