Ejemplo n.º 1
0
    def prepare_training(self, file_id_list_name, wav_dir, lab_dir, mfc_dir, work_dir, multiple_speaker):

        print('---preparing enverionment')
        self.cfg_dir = os.path.join(work_dir, 'config')
        self.model_dir = os.path.join(work_dir, 'model')
        self.cur_dir = os.path.join(self.model_dir, 'hmm0')
        if not os.path.exists(self.cfg_dir):
            os.makedirs(self.cfg_dir)
        if not os.path.exists(self.cur_dir):
            os.makedirs(self.cur_dir)

        self.phonemes = os.path.join(work_dir, 'mono_phone.list')
        self.phoneme_map = os.path.join(work_dir, 'phoneme_map.dict')
        # HMMs
        self.proto = os.path.join(self.cfg_dir, 'proto')
        # SCP files
        self.copy_scp = os.path.join(self.cfg_dir, 'copy.scp')
        self.test_scp = os.path.join(self.cfg_dir, 'test.scp')
        self.train_scp = os.path.join(self.cfg_dir, 'train.scp')
        # CFG
        self.cfg = os.path.join(self.cfg_dir, 'cfg')
        
        # The following is only correct for the default values in the cfg file given
        # in gen_mfcc.py. If you changed the cfg for mfcc extraction, change it here accordingly.
        open(self.cfg, 'w').write("""TARGETRATE = 50000.0
TARGETKIND = USER
WINDOWSIZE = 250000.0
PREEMCOEF = 0.97
USEHAMMING = T
ENORMALIZE = T
CEPLIFTER = 22
NUMCHANS = 20
NUMCEPS = 12
""")

        self.wav_dir = wav_dir
        self.lab_dir = lab_dir
        self.mfc_dir = mfc_dir
        if not os.path.exists(self.mfc_dir):
            os.makedirs(self.mfc_dir)

        self.mono_lab_dir = os.path.join(work_dir, 'mono_no_align')
        if not os.path.exists(self.mono_lab_dir):
            # shutil.rmtree(self.mono_lab_dir)
            os.makedirs(self.mono_lab_dir)

        file_id_list = self._read_file_list(file_id_list_name)
        print('---checking data')
        speaker_utt_dict = self._check_data(file_id_list, multiple_speaker)
        
        print('---feature_normalisation')
        for key_name in list(speaker_utt_dict.keys()):
            print("   ---create normaliser for speaker {}.".format(key_name))
            normaliser = MeanVarianceNorm(39)
            normaliser.feature_normalisation(speaker_utt_dict[key_name], speaker_utt_dict[key_name])  ## save to itself
        print(time.strftime("%c"))

        print('---making proto')
        self._make_proto()
Ejemplo n.º 2
0
    def prepare_training(self, file_id_list_name, lab_dir, work_dir,
                         multiple_speaker):

        print '---preparing enverionment'
        self.cfg_dir = os.path.join(work_dir, 'config')
        self.model_dir = os.path.join(work_dir, 'model')
        self.cur_dir = os.path.join(self.model_dir, 'hmm0')
        if not os.path.exists(self.cfg_dir):
            os.makedirs(self.cfg_dir)
        if not os.path.exists(self.cur_dir):
            os.makedirs(self.cur_dir)

        self.phonemes = os.path.join(work_dir, 'mono_phone.list')
        self.phoneme_map = os.path.join(work_dir, 'phoneme_map.dict')
        # HMMs
        self.proto = os.path.join(self.cfg_dir, 'proto')
        # SCP files
        self.copy_scp = os.path.join(self.cfg_dir, 'copy.scp')
        self.test_scp = os.path.join(self.cfg_dir, 'test.scp')
        self.train_scp = os.path.join(self.cfg_dir, 'train.scp')
        # CFG
        self.cfg = os.path.join(self.cfg_dir, 'cfg')

        self.wav_dir = wav_dir
        self.lab_dir = lab_dir
        self.mfc_dir = os.path.join(work_dir, 'mfc')
        if not os.path.exists(self.mfc_dir):
            os.makedirs(self.mfc_dir)

        self.mono_lab_dir = os.path.join(work_dir, 'mono_no_align')
        if not os.path.exists(self.mono_lab_dir):
            os.makedirs(self.mono_lab_dir)

        self.temp_path = os.path.join(work_dir, 'tmp')
        if not os.path.exists(self.temp_path):
            os.makedirs(self.temp_path)

        self.scp_split_dir = os.path.join(self.temp_path, 'scp_split')
        if not os.path.exists(self.scp_split_dir):
            os.makedirs(self.scp_split_dir)
        self.split_per_utterance = 1000
        file_id_list = self._read_file_list(file_id_list_name)
        print '---checking data'
        speaker_utt_dict = self._check_data(file_id_list, multiple_speaker)

        print '---extracting features'
        self._HCopy()
        print time.strftime("%c")

        print '---feature_normalisation'
        normaliser = MeanVarianceNorm(39)
        for key_name in speaker_utt_dict.keys():
            normaliser.feature_normalisation(
                speaker_utt_dict[key_name],
                speaker_utt_dict[key_name])  ## save to itself
        print time.strftime("%c")

        print '---making proto'
        self._make_proto()
Ejemplo n.º 3
0
    def prepare_training(self, file_id_list_name, wav_dir, lab_dir, work_dir,
                         multiple_speaker):

        print('---preparing environment')
        self.cfg_dir = os.path.join(work_dir, 'config')
        self.model_dir = os.path.join(work_dir, 'model')
        self.cur_dir = os.path.join(self.model_dir, 'hmm0')
        if not os.path.exists(self.cfg_dir):
            os.makedirs(self.cfg_dir)
        if not os.path.exists(self.cur_dir):
            os.makedirs(self.cur_dir)

        self.phonemes = os.path.join(work_dir, 'mono_phone.list')
        self.phoneme_map = os.path.join(work_dir, 'phoneme_map.dict')
        # HMMs
        self.proto = os.path.join(self.cfg_dir, 'proto')
        # SCP files
        self.copy_scp = os.path.join(self.cfg_dir, 'copy.scp')
        self.test_scp = os.path.join(self.cfg_dir, 'test.scp')
        self.train_scp = os.path.join(self.cfg_dir, 'train.scp')
        # CFG
        self.cfg = os.path.join(self.cfg_dir, 'cfg')

        self.wav_dir = "/lium/raid01_b/tgranjon/synpaflex/wavs"
        self.lab_dir = lab_dir
        self.mfc_dir = os.path.join(work_dir, 'mfc')
        if not os.path.exists(self.mfc_dir):
            os.makedirs(self.mfc_dir)

        self.mono_lab_dir = os.path.join(work_dir, 'mono_no_align')
        if not os.path.exists(self.mono_lab_dir):
            os.makedirs(self.mono_lab_dir)

        file_id_list = self._read_file_list(file_id_list_name)
        print('---checking data')
        speaker_utt_dict = self._check_data(file_id_list, multiple_speaker)

        print('---extracting features')
        self._HCopy()
        print(time.strftime("%c"))

        print('---feature_normalisation')
        for key_name in speaker_utt_dict.keys():
            normaliser = MeanVarianceNorm(39)
            normaliser.feature_normalisation(
                speaker_utt_dict[key_name],
                speaker_utt_dict[key_name])  ## save to itself
        print(time.strftime("%c"))

        print('---making proto')
        self._make_proto()
Ejemplo n.º 4
0
    def prepare_training(self, file_id_list_name, wav_dir, lab_dir, work_dir,
                         multiple_speaker):

        print("---preparing enverionment")
        self.cfg_dir = os.path.join(work_dir, "config")
        self.model_dir = os.path.join(work_dir, "model")
        self.cur_dir = os.path.join(self.model_dir, "hmm0")
        if not os.path.exists(self.cfg_dir):
            os.makedirs(self.cfg_dir)
        if not os.path.exists(self.cur_dir):
            os.makedirs(self.cur_dir)

        self.phonemes = os.path.join(work_dir, "mono_phone.list")
        self.phoneme_map = os.path.join(work_dir, "phoneme_map.dict")
        # HMMs
        self.proto = os.path.join(self.cfg_dir, "proto")
        # SCP files
        self.copy_scp = os.path.join(self.cfg_dir, "copy.scp")
        self.test_scp = os.path.join(self.cfg_dir, "test.scp")
        self.train_scp = os.path.join(self.cfg_dir, "train.scp")
        # CFG
        self.cfg = os.path.join(self.cfg_dir, "cfg")

        self.wav_dir = wav_dir
        self.lab_dir = lab_dir
        self.mfc_dir = os.path.join(work_dir, "mfc")
        if not os.path.exists(self.mfc_dir):
            os.makedirs(self.mfc_dir)

        self.mono_lab_dir = os.path.join(work_dir, "mono_no_align")
        if not os.path.exists(self.mono_lab_dir):
            os.makedirs(self.mono_lab_dir)

        file_id_list = self._read_file_list(file_id_list_name)
        print("---checking data")
        speaker_utt_dict = self._check_data(file_id_list, multiple_speaker)

        print("---extracting features")
        self._HCopy()
        print(time.strftime("%c"))

        print("---feature_normalisation")
        normaliser = MeanVarianceNorm(39)
        for key_name in list(speaker_utt_dict.keys()):
            normaliser.feature_normalisation(
                speaker_utt_dict[key_name],
                speaker_utt_dict[key_name])  ## save to itself
        print(time.strftime("%c"))

        print("---making proto")
        self._make_proto()
Ejemplo n.º 5
0
    def prepare_training(self, file_id_list_name, wav_dir, lab_dir, work_dir, multiple_speaker):

        print('---preparing enverionment')
        self.cfg_dir = os.path.join(work_dir, 'config')
        self.model_dir = os.path.join(work_dir, 'model')
        self.cur_dir = os.path.join(self.model_dir, 'hmm0')
        if not os.path.exists(self.cfg_dir):
            os.makedirs(self.cfg_dir)
        if not os.path.exists(self.cur_dir):
            os.makedirs(self.cur_dir)

        self.phonemes = os.path.join(work_dir, 'mono_phone.list')
        self.phoneme_map = os.path.join(work_dir, 'phoneme_map.dict')
        # HMMs
        self.proto = os.path.join(self.cfg_dir, 'proto')
        # SCP files
        self.copy_scp = os.path.join(self.cfg_dir, 'copy.scp')
        self.test_scp = os.path.join(self.cfg_dir, 'test.scp')
        self.train_scp = os.path.join(self.cfg_dir, 'train.scp')
        # CFG
        self.cfg = os.path.join(self.cfg_dir, 'cfg')

        self.wav_dir=wav_dir
        self.lab_dir = lab_dir
        self.mfc_dir = os.path.join(work_dir, 'mfc')
        if not os.path.exists(self.mfc_dir):
            os.makedirs(self.mfc_dir)

        self.mono_lab_dir = os.path.join(work_dir, 'mono_no_align')
        if not os.path.exists(self.mono_lab_dir):
            os.makedirs(self.mono_lab_dir)

        file_id_list = self._read_file_list(file_id_list_name)
        print('---checking data')
        speaker_utt_dict = self._check_data(file_id_list, multiple_speaker)

        print('---extracting features')
        self._HCopy()
        print(time.strftime("%c"))

        print('---feature_normalisation')
        normaliser = MeanVarianceNorm(39)
        for key_name in list(speaker_utt_dict.keys()):
            normaliser.feature_normalisation(speaker_utt_dict[key_name], speaker_utt_dict[key_name])  ## save to itself
        print(time.strftime("%c"))

        print('---making proto')
        self._make_proto()