python pytorch语音识别_在pytorch中为ASR加载librispeech
你的问题很宽泛:你在看音频文件的记录吗?如果是这样的话,它们在每个目录的文本文件中,每行都以文件名(不带扩展名)开头。在尤其是这种方法,它给出了一个音频文件列表及其对Librispeech语料库的转录:def get_data_librispeech(self, raw_data_path):text_files = self.find_files(raw_data_path, ".txt")re
你的问题很宽泛:你在看音频文件的记录吗?如果是这样的话,它们在每个目录的文本文件中,每行都以文件名(不带扩展名)开头。在
尤其是这种方法,它给出了一个音频文件列表及其对Librispeech语料库的转录:def get_data_librispeech(self, raw_data_path):
text_files = self.find_files(raw_data_path, ".txt")
result = []
for text_file in text_files:
directory = os.path.dirname(text_file)
with open(text_file, "r") as f:
lines = f.read().split("\n")
for line in lines:
head = line.split(' ')[0]
if len(head) < 5:
# Not a line with a file desc
break
audio_file = directory + "/" + head + ".flac"
if os.path.exists(audio_file):
result.append([audio_file, self.clean_label(line.replace(head, "")), None])
return result
注意:每个项目的第三个值总是无,因为它应该被另一个方法中的音频长度替换。在
你不需要用相应的字符来标记音频的每一帧,CTC将通过处理完整的音频和相应的转录本来处理它。在
更多推荐
所有评论(0)